17.02.2010, 05:59
the problem is when i do /inf many times i get loads of cars and after [10] seconds they suppose to disappear if nobody is driving them but they respawn on the same place.
can someone help me to make only one car PER person so if he spawned a car already and types /inf or /nrg the old car disappears.
here is my code:
public OnPlayerCommandText(playerid, cmdtext[])
{
new Float:Pos[4],inf;
new Float:Pose[4],nrg;
if(!strcmp(cmdtext,"/inf",true))
{
GetPlayerPos(playerid,Pos[1],Pos[2],Pos[3]);
inf=CreateVehicle(411,Pos[1],Pos[2],Pos[3],0,-1,-1,10);
PutPlayerInVehicle(playerid,inf, 0);
SendClientMessage(playerid,0xFF641AFF,"SERVER: You have Spawned An Infernus.");
return 1;
}
if(!strcmp(cmdtext,"/nrg",true))
{
GetPlayerPos(playerid,Pose[1],Pose[2],Pose[3]);
nrg=CreateVehicle(522,Pose[1],Pose[2],Pose[3],0,-1,-1,10);
PutPlayerInVehicle(playerid,nrg, 0);
SendClientMessage(playerid,0xFF641AFF,"SERVER: You have Spawned An NRG-500.");
return 1;
}
return 0;
}
thank you!
can someone help me to make only one car PER person so if he spawned a car already and types /inf or /nrg the old car disappears.
here is my code:
public OnPlayerCommandText(playerid, cmdtext[])
{
new Float:Pos[4],inf;
new Float:Pose[4],nrg;
if(!strcmp(cmdtext,"/inf",true))
{
GetPlayerPos(playerid,Pos[1],Pos[2],Pos[3]);
inf=CreateVehicle(411,Pos[1],Pos[2],Pos[3],0,-1,-1,10);
PutPlayerInVehicle(playerid,inf, 0);
SendClientMessage(playerid,0xFF641AFF,"SERVER: You have Spawned An Infernus.");
return 1;
}
if(!strcmp(cmdtext,"/nrg",true))
{
GetPlayerPos(playerid,Pose[1],Pose[2],Pose[3]);
nrg=CreateVehicle(522,Pose[1],Pose[2],Pose[3],0,-1,-1,10);
PutPlayerInVehicle(playerid,nrg, 0);
SendClientMessage(playerid,0xFF641AFF,"SERVER: You have Spawned An NRG-500.");
return 1;
}
return 0;
}
thank you!