jeudi 11 septembre 2014

Command /v for spawn vehicle

I do this command that one player spawn vehicle with /v [id vehicle] , and i want there are one vehicle * player but don't work very well, cause when one player spawn vehicle and spawn other, the old vehicle go destroy, if i spawn a vehicle and other player spawn vehicle my vehicle go destroy.

[Sorry for the bad english i'm italian and i don't stpeak very well english]



if(strcmp(cmd, "/v", true) == 0)

{

new Float: poscord[3];

new tmp[128];

new color1[128];

new color2[128];

tmp = strtok(cmdtext, idx);

color1 = strtok(cmdtext,idx);

color2 = strtok(cmdtext,idx);

PlayerInfo[playerid][VC] = 2;

if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /V [vehicleid] [color1] [color2]");

for(new x=0;x <= PlayerInfo[playerid][VC];x++)

{

if(PlayerInfo[playerid][VC] == 2)

{

DestroyVehicle(x);

}

}

GetPlayerPos(playerid,poscord[0],poscord[1],poscord[2]);

PlayerInfo[playerid][Ve] = CreateVehicle(strval(tmp),poscord[0],poscord[1],poscord[2],0,strval(color1),strval(color2),-1);

PutPlayerInVehicle(playerid,PlayerInfo[playerid][Ve],0);

return 1;

}




Aucun commentaire:

Enregistrer un commentaire