I need some help here - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: I need some help here (
/showthread.php?tid=511797)
I need some help here -
Proximo - 07.05.2014
Hey there Community,
I need some help here,
Well, how do I create a command. "/v [name/id]" where the condition is that a player cannot spawn a vehicle if he/she already has a vehicle and when someone spawns a vehicle it should remove the vehicle that was previously used by him/her.
I know my help requests might sound stupid, but I would really appreciate if you help me out.
EDIT: I am using zCMD.
Thanks in advance.
Cheers.
Re: I need some help here -
UnknownGamer - 07.05.2014
That's easy!
I learnt this from the person named "MISIUR" here on SA-MP Forums :P.
At the top of your script, make a new variable named
pawn Код:
new AlreadySpawned[MAX_PLAYERS] = 0;
Then do in the ZCMD, ...
pawn Код:
CMD:v(playerid, params[])
{
if(AlreadySpawned[playerid] != 0) return SCM(playerid, -1, "Handle already obtained.");
vID = CreateVehicle(bla bla bla);
AlreadySpawned[playerid] = vID;
PutPlayerInVehicle(playerid, vID, 0);
}
Then if you have like a destroy veh command, just use same thing, again.
pawn Код:
AlreadySpawned[playerid] = 0;
--
Credit goes to Misiur, for learning me to script PAWNO, in such a way I never did before.
By the way, #define SCM SendClientMessage - I just use that instead of stock SendClientMessage 1000x, easier to type.