luboskubista 4 Odesláno: 3. Únor, 2013 Share Odesláno: 3. Únor, 2013 Předně bych chtěl říct, že tento tutoriál není z mě hlavy, ale převzatý ze stránek sa-mp.com a to od autora Godhimself. Já jsem opravil chyby a přidal novou barvu neonu. Dopručuju, abyste tento tutoriál využili k výrobě FilterScriptu, když jsem si ho přidal do GM, tak mě ostatní příkazy nefungovaly, ale po vytvoření FS vše jelo tak jak má Zde je samotný tutoriál: 1. přidáme nový includ: #include <zcmd> 2 .nadefinujeme si barvy: #define COLOUR_WHITE 0xFFFFFFAA #define COLOUR_RED 0xFF0000FF #define WHITE_HEX {FFFFFF} // u této barvy si nejsem jistý, jestli tu někde je, ale v originálu tam je ,takže ji tam radši nechte a dialogy: #define NEON_DIALOG 0 #define BLUE_NEONS_PRICE 10000//Tuto částku si můžete změnit dle libosti #define RED_NEONS_PRICE 10000//Tuto částku si můžete změnit dle libosti #define GREEN_NEONS_PRICE 10000//Tuto částku si můžete změnit dle libosti #define YELLOW_NEONS_PRICE 10000//Tuto částku si můžete změnit dle libosti #define PINK_NEONS_PRICE 10000//Tuto částku si můžete změnit dle libosti #define WHITE_NEONS_PRICE 10000//Tuto částku si můžete změnit dle libosti 3. Do public OnVehicleDeath(vehicleid, killerid) public OnVehicleDeath(vehicleid, killerid) { new i; for(i = 0; i < MAX_PLAYERS; i ++) { if(IsPlayerConnected(i) && GetPlayerVehicleID(i) == vehicleid) { if(GetPVarInt(i, "HasBlueNeons") == 1) { DeletePVar(i, "HasBlueNeons"); DestroyObject(GetPVarInt(i, "BlueNeons1")); DestroyObject(GetPVarInt(i, "BlueNeons2")); } else if(GetPVarInt(i, "HasRedNeons") == 1) { DeletePVar(i, "HasRedNeons"); DestroyObject(GetPVarInt(i, "RedNeons1")); DestroyObject(GetPVarInt(i, "RedNeons2")); } else if(GetPVarInt(i, "HasGreenNeons") == 1) { DeletePVar(i, "HasGreenNeons"); DestroyObject(GetPVarInt(i, "GreenNeons1")); DestroyObject(GetPVarInt(i, "GreenNeons2")); } else if(GetPVarInt(i, "HasYellowNeons") == 1) { DeletePVar(i, "HasYellowNeons"); DestroyObject(GetPVarInt(i, "YellowNeons1")); DestroyObject(GetPVarInt(i, "YellowNeons2")); } else if(GetPVarInt(i, "HasPinkNeons") == 1) { DeletePVar(i, "HasPinkNeons"); DestroyObject(GetPVarInt(i, "PinkNeons1")); DestroyObject(GetPVarInt(i, "PinkNeons2")); } else if(GetPVarInt(i, "HasWhiteNeons") == 1) { DeletePVar(i, "HasWhiteNeons"); DestroyObject(GetPVarInt(i, "WhiteNeons1")); DestroyObject(GetPVarInt(i, "WhiteNeons2")); } } } return 1; } 4. do public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch(dialogid) { case NEON_DIALOG: { if(response) { switch(listitem) { case 0: { if(GetPlayerMoney(playerid) >= BLUE_NEONS_PRICE) { SetPVarInt(playerid, "HasBlueNeons", 1); SetPVarInt(playerid, "BlueNeons1", CreateObject(18648,0,0,0,0,0,0)); SetPVarInt(playerid, "BlueNeons2", CreateObject(18648,0,0,0,0,0,0)); AttachObjectToVehicle(GetPVarInt(playerid, "BlueNeons1"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(GetPVarInt(playerid, "BlueNeons2"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0); GivePlayerMoney(playerid, - BLUE_NEONS_PRICE); PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0); new string[80]; format(string, sizeof(string), "Úspěšně jsi vytvořil modré neony za: $%d", BLUE_NEONS_PRICE); SendClientMessage(playerid, COLOUR_WHITE, string); } else { SendClientMessage(playerid, COLOUR_RED,"Nemáš dostatek peněz."); } } case 1: { if(GetPlayerMoney(playerid) >= RED_NEONS_PRICE) { SetPVarInt(playerid, "HasRedNeons", 1); SetPVarInt(playerid, "RedNeons1", CreateObject(18647,0,0,0,0,0,0)); SetPVarInt(playerid, "RedNeons2", CreateObject(18647,0,0,0,0,0,0)); AttachObjectToVehicle(GetPVarInt(playerid, "RedNeons1"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(GetPVarInt(playerid, "RedNeons2"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0); GivePlayerMoney(playerid, - RED_NEONS_PRICE); PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0); new string[80]; format(string, sizeof(string), "Úspěšně jsi vytvořil červené neony za: $%d", RED_NEONS_PRICE); SendClientMessage(playerid, COLOUR_WHITE, string); } else { SendClientMessage(playerid, COLOUR_RED,"Nemáš dostatek peněz."); } } case 2: { if(GetPlayerMoney(playerid) >= GREEN_NEONS_PRICE) { SetPVarInt(playerid, "HasGreenNeons", 1); SetPVarInt(playerid, "GreenNeons1", CreateObject(18649,0,0,0,0,0,0)); SetPVarInt(playerid, "GreenNeons2", CreateObject(18649,0,0,0,0,0,0)); AttachObjectToVehicle(GetPVarInt(playerid, "GreenNeons1"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(GetPVarInt(playerid, "GreenNeons2"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0); GivePlayerMoney(playerid, - GREEN_NEONS_PRICE); PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0); new string[80]; format(string, sizeof(string), "Úspěšně jsi vytvořil zelené neony za: $%d", GREEN_NEONS_PRICE); SendClientMessage(playerid, COLOUR_WHITE, string); } else { SendClientMessage(playerid, COLOUR_RED,"Nemáš dostatek peněz."); } } case 3: { if(GetPlayerMoney(playerid) >= YELLOW_NEONS_PRICE) { SetPVarInt(playerid, "HasYellowNeons", 1); SetPVarInt(playerid, "YellowNeons1", CreateObject(18650,0,0,0,0,0,0)); SetPVarInt(playerid, "YellowNeons2", CreateObject(18650,0,0,0,0,0,0)); AttachObjectToVehicle(GetPVarInt(playerid, "YellowNeons1"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(GetPVarInt(playerid, "YellowNeons2"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0); GivePlayerMoney(playerid, - YELLOW_NEONS_PRICE); PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0); new string[80]; format(string, sizeof(string), "Úspěšně jsi vytvořil žluté neony za: $%d", YELLOW_NEONS_PRICE); SendClientMessage(playerid, COLOUR_WHITE, string); } else { SendClientMessage(playerid, COLOUR_RED,"Nemáš dostatek peněz."); } } case 4: { if(GetPlayerMoney(playerid) >= PINK_NEONS_PRICE) { SetPVarInt(playerid, "HasPinkNeons", 1); SetPVarInt(playerid, "PinkNeons1", CreateObject(18651,0,0,0,0,0,0)); SetPVarInt(playerid, "PinkNeons2", CreateObject(18651,0,0,0,0,0,0)); AttachObjectToVehicle(GetPVarInt(playerid, "PinkNeons1"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(GetPVarInt(playerid, "PinkNeons2"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0); GivePlayerMoney(playerid, - PINK_NEONS_PRICE); PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0); new string[80]; format(string, sizeof(string), "Úspěšně jsi vytvořil růžové neony za: $%d", PINK_NEONS_PRICE); SendClientMessage(playerid, COLOUR_WHITE, string); } else { SendClientMessage(playerid, COLOUR_RED,"Nemáš dostatek peněz."); } } case 5: { if(GetPlayerMoney(playerid) >= WHITE_NEONS_PRICE) { SetPVarInt(playerid, "HasWhiteNeons", 1); SetPVarInt(playerid, "WhiteNeons1", CreateObject(18652,0,0,0,0,0,0)); SetPVarInt(playerid, "WhiteNeons2", CreateObject(18652,0,0,0,0,0,0)); AttachObjectToVehicle(GetPVarInt(playerid, "WhiteNeons1"), GetPlayerVehicleID(playerid), -0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(GetPVarInt(playerid, "WhiteNeons2"), GetPlayerVehicleID(playerid), 0.8, 0.0, -0.70, 0.0, 0.0, 0.0); GivePlayerMoney(playerid, - WHITE_NEONS_PRICE); PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0); new string[80]; format(string, sizeof(string), "Úspěšně jsi vytvořil bílé neony za: $%d", WHITE_NEONS_PRICE); SendClientMessage(playerid, COLOUR_WHITE, string); } else { SendClientMessage(playerid, COLOUR_RED,"Nemáš dostatek peněz."); } } case 6: { if(GetPVarInt(playerid, "HasBlueNeons") == 1) { DeletePVar(playerid, "HasBlueNeons"); DestroyObject(GetPVarInt(playerid, "BlueNeons1")); DestroyObject(GetPVarInt(playerid, "BlueNeons2")); SendClientMessage(playerid, COLOUR_WHITE, "Úspěšně jsi odstranil neon."); } else if(GetPVarInt(playerid, "HasRedNeons") == 1) { DeletePVar(playerid, "HasRedNeons"); DestroyObject(GetPVarInt(playerid, "RedNeons1")); DestroyObject(GetPVarInt(playerid, "RedNeons2")); SendClientMessage(playerid, COLOUR_WHITE, "Úspěšně jsi odstranil neon."); } else if(GetPVarInt(playerid, "HasGreenNeons") == 1) { DeletePVar(playerid, "HasGreenNeons"); DestroyObject(GetPVarInt(playerid, "GreenNeons1")); DestroyObject(GetPVarInt(playerid, "GreenNeons2")); SendClientMessage(playerid, COLOUR_WHITE, "Úspěšně jsi odstranil neon."); } else if(GetPVarInt(playerid, "HasYellowNeons") == 1) { DeletePVar(playerid, "HasYellowNeons"); DestroyObject(GetPVarInt(playerid, "YellowNeons1")); DestroyObject(GetPVarInt(playerid, "YellowNeons2")); SendClientMessage(playerid, COLOUR_WHITE, "Úspěšně jsi odstranil neon."); } else if(GetPVarInt(playerid, "HasPinkNeons") == 1) { DeletePVar(playerid, "HasPinkNeons"); DestroyObject(GetPVarInt(playerid, "PinkNeons1")); DestroyObject(GetPVarInt(playerid, "PinkNeons2")); SendClientMessage(playerid, COLOUR_WHITE, "Úspěšně jsi odstranil neon."); } else if(GetPVarInt(playerid, "HasWhiteNeons") == 1) { DeletePVar(playerid, "HasWhiteNeons"); DestroyObject(GetPVarInt(playerid, "WhiteNeons1")); DestroyObject(GetPVarInt(playerid, "WhiteNeons2")); SendClientMessage(playerid, COLOUR_WHITE, "Úspěšně jsi odstranil neon."); } else { SendClientMessage(playerid, COLOUR_WHITE, "Nemáš žádné neony na odstranění."); } } } } } } return 1; } 5. Zde je samotný příkaz CMD:neon(playerid, params[]) { new string[200]; switch(GetVehicleModel(GetPlayerVehicleID(playerid)))// toto je seznam ID vozidel, na která lze přidat neony { case 562,565,559,561,560,575,534,567,536,535,576,411,579,602,496,518,527,589,597,419, 533,526,474,545,517,410,600,436,580,439,549,491,445,604,507,585,587,466,492,546,551,516, 426,547,405,409,550,566,406,540,421,529,431,438,437,420,525,552,416,433,427,490,528, 407,544,470,598,596,599,601,428,499,609,524,578,486,573,455,588,403,514,423, 414,443,515,456,422,482,530,418,572,413,440,543,583,478,554,402,542,603,475,568,504,457, 483,508,429,541,415,480,434,506,451,555,477,400,404,489,479,442,458,467,558: { format(string, sizeof(string), "Modré Neony: $%d\nČerverné Neony: $%d\nZelené Neony: $%d\nŽluté Neony: $%d\nRůžové Neony: $%d\nBílé Neony: $%d\nOdebrat neony: Zadarmo", BLUE_NEONS_PRICE, RED_NEONS_PRICE, GREEN_NEONS_PRICE, YELLOW_NEONS_PRICE, PINK_NEONS_PRICE, WHITE_NEONS_PRICE); // Toto je pokračování předešlého řádku ShowPlayerDialog(playerid, NEON_DIALOG, DIALOG_STYLE_LIST, "Neon Shop", string, "Vybrat", "Cancel"); } default: return SendClientMessage(playerid,COLOUR_RED,"Toto vozidlo nelze vytunit, nebo nejsi ve vozidle."); } return true; } 2 Link to comment Share on other sites More sharing options...
Mivčo 90 Odesláno: 3. Únor, 2013 Share Odesláno: 3. Únor, 2013 Pekný TuT 10/10 1 Link to comment Share on other sites More sharing options...
luboskubista 4 Odesláno: 3. Únor, 2013 Author Share Odesláno: 3. Únor, 2013 Dík 1 Link to comment Share on other sites More sharing options...
Guest Norhy Odesláno: 3. Únor, 2013 Share Odesláno: 3. Únor, 2013 Mohol si to aspoň dať do kódu alebo spoilera .. Ináč si to mohol aj popísať, čo tie funkcie robia, čo sa stane keď toto dáme tu a tamto sem atď .. Ináč to beriem len ako skopčený kód, ako návod mi to nepripadá, napr. nováčikovia si to len skopírujú a nič sa nenaučia.. Link to comment Share on other sites More sharing options...
Recommended Posts