15.01.2012, 21:23
Ok this is being a pain,i have just converted my vehicle script to zcmd and sscanf,but i have run into a problem with this command,so if you can show me the light,i will be happy
Ok here is what i have
Ok i started to change it to sscanf,but run into problems
Now im not sure what is wrong,but it throws a wobbly at me and tells me its not my car or if i change this line
to
it freezes for about 30 seconds then dumps all my cars on me
Anyways cheers for any help given
Ok here is what i have
Код:
CMD:callcar(playerid, params[]) { if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "!! You can't call your vehicle while your in a vehicle !!"); if(isnull(params)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /callcar [vehicleid]"); new tmp[128],Index; tmp = strtok(params,Index); new Float:playerx,Float:playery,Float:playerz,Float:playera; for(new i=1;i<MAX_VEHICLES;i++) { if(OwnedVeh(i)==strval(tmp)) { if(IsPlayerAdmin(playerid)) { GetPlayerPos(playerid,playerx,playery,playerz); GetPlayerFacingAngle(playerid,playera); DestroyVehicle(i); CreateVehicle(vInfo[OwnedVeh(i)][vModel],playerx,playery,playerz,playera,vInfo[OwnedVeh(i)][vColor1], vInfo[OwnedVeh(i)][vColor2],600000); SetVehicleNumberPlate(i, vInfo[OwnedVeh(i)][vPlate]); ChangeVehiclePaintjob(i, vInfo[OwnedVeh(i)][vPaintJ]); for(new iMod = 0; iMod < MAX_VEH_MODS; ++iMod) { if(vMods[i][iMod] > 0) { AddVehicleComponent(i, vMods[i][iMod]); } } SendClientMessage(playerid,COLOR_RED,"[ » ] Your vehicle has been teleported to you !"); PutPlayerInVehicle(playerid,i,0); } else if(strmatch(vInfo[OwnedVeh(i)][vOwner],pName(playerid))) { if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_RED, "[ » ] You dont have money to call your vehicle !"); GetPlayerPos(playerid,playerx,playery,playerz); GetPlayerFacingAngle(playerid,playera); DestroyVehicle(i); CreateVehicle(vInfo[OwnedVeh(i)][vModel],playerx,playery,playerz,playera,vInfo[OwnedVeh(i)][vColor1], vInfo[OwnedVeh(i)][vColor2],600000); SetVehicleNumberPlate(i, vInfo[OwnedVeh(i)][vPlate]); ChangeVehiclePaintjob(i, vInfo[OwnedVeh(i)][vPaintJ]); for(new iMod = 0; iMod < MAX_VEH_MODS; ++iMod) { if(vMods[i][iMod] > 0) { AddVehicleComponent(i, vMods[i][iMod]); } } GivePlayerMoney(playerid,-100); SendClientMessage(playerid,COLOR_GREY,"[ » ] Your vehicle has been teleported to you !"); SendClientMessage(playerid,COLOR_GREY,"[ » ] This has cost you $100 !"); PutPlayerInVehicle(playerid,i,0); } else { SendClientMessage(playerid,COLOR_RED,"[ » ] This is not your vehicle !"); } } } return 1; }
Код:
CMD:callcar(playerid, params[]) { if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "!! You can't call your vehicle while your in a vehicle !!"); new calc[128],Float:playerx,Float:playery,Float:playerz,Float:playera; if(sscanf(params, "i",calc)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /callcar [vehicleid]"); for(new i=1;i<MAX_VEHICLES;i++) { if(OwnedVeh(i)==strval(calc)) {
Код:
if(OwnedVeh(i)==strval(calc)) {
Код:
if(strmatch(OwnedVeh(i),calc)) {
Anyways cheers for any help given