I need some help here
#1

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.
Reply
#2

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)