20.01.2012, 16:57
Код:
CMD:mo(playerid, params[]) { new string[128], odabir[128], boja1, boja2; if(sscanf(params, "s[20]D(-1)D(-1)", odabir, boja1, boja2)) { if(Motolist[playerid][MTyp]!=-1) { format(string,sizeof(string), "{0080C0}___________________{76BBDD}%s{0080C0}___________________", LVehiclesName[Motolist[playerid][MotoModel]-400]); SendClientMessage(playerid, 0x94B6B6FF, string); SendClientMessage(playerid, 0x5A8E8EFF,"{B1D8EB}|POMOC: {76BBDD}Koristi {0080C0}/gps # {76BBDD}da oznacis moto shop!"); SendClientMessage(playerid, 0x6C9A9AFF,"{B1D8EB}|MOTOR| {0080C0}(/mo)tor prodaj, boja, lociraj, parkiraj"); SendClientMessage(playerid, 0x7CA5A5FF,"{B1D8EB}|MOTOR| {0080C0}(/mo)tor napusti"); return 1; } } else { if(strcmp(odabir, "napusti", true) == 0) { if (MBuylist[MotoSpectating[playerid][0]][MCarid]) { TogglePlayerControllable(playerid,1); SetVehicleParamsForAll(MBuylist[MotoSpectating[playerid][0]][MCarid],0,0); MotoSpectating[playerid][0]=-1; TextDrawDestroy(imevozila[playerid]);TextDrawDestroy(cijenavozila[playerid]);TextDrawDestroy(registracijavozila[playerid]); TextDrawHideForPlayer(playerid, imevozila[playerid]); TextDrawHideForPlayer(playerid, cijenavozila[playerid]); TextDrawHideForPlayer(playerid, registracijavozila[playerid]); RemovePlayerFromVehicle(playerid); TextDrawHideForPlayer(playerid, imevozila[playerid]); TextDrawHideForPlayer(playerid, cijenavozila[playerid]); TextDrawHideForPlayer(playerid, registracijavozila[playerid]); } else { SendClientMessage(playerid, COLOR_GREY, "Nisi u izlozbenom motoru!"); } return 1; } else if(strcmp(odabir,"parkiraj",true) == 0) { if (IsPlayerInVehicle(playerid,Motolist[playerid][MCarid])) { GetVehiclePos(Motolist[playerid][MCarid],Motolist[playerid][MX],Motolist[playerid][MY],Motolist[playerid][MZ]); GetVehicleZAngle(Motolist[playerid][MCarid],Motolist[playerid][MRotation]); MotoSave(playerid); SendClientMessage(playerid, COLOR_WHITE, "Tvoj ce se motor odsada ovdje spawnati!"); return 1; } else { SendClientMessage(playerid, COLOR_GREY, "Ovo nije tvoje motor/nisi u vozilu!"); } return 1; } else if(strcmp(odabir,"lociraj",true) == 0) { if (Motolist[playerid][MTyp] == -1) { SendClientMessage(playerid, COLOR_GREY, "Nemas motor!"); return 1; } if (Motolist[playerid][MTyp]!=-1) { { new Float:x, Float:y, Float:z; GetVehiclePos(Motolist[playerid][MCarid], x, y, z); SetPlayerCheckpoint(playerid,x,y,z, 6.0); SendClientMessage(playerid, 0x0080C0FF, "Lokacija tvog vozila je postavljena na mapi!"); return 1; } } } else if(strcmp(odabir,"boja",true) == 0) { if(Motolist[playerid][MTyp]!=-1) { { if(boja1 > 2 || boja1 < 1) { SendClientMessage(playerid, COLOR_GRAD3,"Boja 1 ili 2!"); return 1; } if(boja2 > 126) { SendClientMessage(playerid, COLOR_GRAD3,"Najveci ID boje je 126"); return 1; } if (GetPlayerCash(playerid) < 3000) { SendClientMessage(playerid, COLOR_GRAD3,"Nemas dovoljno novca ($3000)"); return 1; } if(boja1 == 1) { Motolist[playerid][MColor1] = boja2; MotoSave(playerid); format(string, sizeof(string), "Boja 1 postavljena na ID %d -$3000",boja2); SendClientMessage(playerid, 0x0080C0FF,string); } else { Motolist[playerid][MColor2] = boja2; MotoSave(playerid); format(string, sizeof(string), "Boja 2 postavljena na ID %d -$3000",boja2); SendClientMessage(playerid, 0x0080C0FF,string); } SendClientMessage(playerid, COLOR_GRAD6, "Tvoj nova boja ce stici uskoro(poslije reloga)!"); GivePlayerCash(playerid,-3000); } } if(Motolist[playerid][MTyp] == -1) { SendClientMessage(playerid, COLOR_GRAD6, "Nemas motor!"); return 1; } return 1; } else if(strcmp(odabir,"prodaj",true) == 0) { if (Motolist[playerid][MTyp]!=-1) { new price = (Motolist[playerid][MCijena])/5*4; if (IsPlayerInVehicle(playerid,Motolist[playerid][MCarid])) { RemovePlayerFromVehicle(playerid); } GivePlayerCash(playerid, price); DestroyVehicle(Motolist[playerid][MCarid]); Motolist[playerid][MTyp]=-1; Motolist[playerid][MX]=0.0; Motolist[playerid][MY]=0.0; Motolist[playerid][MZ]=0.0; Motolist[playerid][MRotation]=0.0; Motolist[playerid][MLock]=0; Motolist[playerid][MCarid]=-1; Motolist[playerid][MColor1]=-1; Motolist[playerid][MColor2]=-1; Motolist[playerid][MVlasnik] = 0; SacuvajIgraca(playerid); MotoSave(playerid); PlayerInfo[playerid][pVoziloSpawnano] = 0; format(string,128,"{2994CA}Prodao si svoj motor za {AED6EB}$%i!",price); SendClientMessage(playerid, 0x698F8FFF, string); return 1; } else { SendClientMessage(playerid, COLOR_GREY, "Nemas motor!"); } return 1; } else if(strcmp(odabir,"spawn",true) == 0) { if (PlayerInfo[playerid][pVoziloSpawnano] == 0) { GetPlayerPos(playerid ,Motolist[playerid][MX],Motolist[playerid][MY],Motolist[playerid][MZ]); GetVehiclePos(Motolist[playerid][MCarid],Motolist[playerid][MX],Motolist[playerid][MY],Motolist[playerid][MZ]); GetVehicleZAngle(Motolist[playerid][MCarid],Motolist[playerid][MRotation]); GetXYInFrontOfPosition(Motolist[playerid][MX],Motolist[playerid][MY],Motolist[playerid][MRotation],5.0); Motolist[playerid][MCarid] = CreateVehicle(Motolist[playerid][MotoModel],Motolist[playerid][MX],Motolist[playerid][MY]+2.0,Motolist[playerid][MZ],0.0,0,0,-1); SetVehicleNumberPlate(Motolist[playerid][MCarid], Motolist[playerid][MBrojRegistracije]); MotoSave(playerid); PlayerInfo[playerid][pVoziloSpawnano] = 1; SacuvajIgraca(playerid); SendClientMessage(playerid, 0x698F8FFF, "Spawnao si svoj motor !"); return 1; } else { SendClientMessage(playerid, COLOR_GREY, "Nisi kupio motor!"); } return 1; } else if(strcmp(odabir,"lock",true) == 0) { if (Motolist[playerid][MTyp]!=-1) { if (Motolist[playerid][MCarid]!=-1) { if (Motolist[playerid][MLock]==0) { Motolist[playerid][MLock]=1; SetVehicleParamsForAll(Motolist[playerid][MCarid],0,1); SetVehicleParamsForPlayer(Motolist[playerid][MCarid],playerid,0,1); SendClientMessage(playerid, 0x698F8FFF, "Zakljucao si svoj motor!"); } else { Motolist[playerid][MLock]=0; SetVehicleParamsForAll(Motolist[playerid][MCarid],0,0); SendClientMessage(playerid, 0x698F8FFF, "Otkljucao si svoj motor!"); } } else { SendClientMessage(playerid, COLOR_GREY, "Tvoj motor je pokvaren. Moras ga popraviti!"); } } else { SendClientMessage(playerid, COLOR_GREY, "Nemas motor!"); } } } return 1; }
I tried to switch this but cant.Please help.