SA-MP Forums Archive
Help - 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: Help (/showthread.php?tid=583831)



Help - ZToPMaN - 31.07.2015

Iam tring to make a limit for cars in my script
I tried to make one, but i can't.
I need help.

<quote> new Float:X;
new Float:Y;
new Float:Z;
#define Infernus 5
if (Infernus > 5) return SendClientMessage(playerid, -1, " You can't spawn more than 5 Infernus car.! ");
GetPlayerPos(playerid,X,Y,Z);
Infernus = CreateVehicle(411,X,Y+5,Z,1,1,1,1000); </quote>


AW: Help - Kaliber - 31.07.2015

Do it like this

PHP код:
//@top of the script:
#define MAX_INFERNUS 5
new max_cars[MAX_PLAYERS char];
//OnPlayerConnect
max_cars{playerid}=0//So it get resettet
//Then in the Command:
new Float:x,Float:y,Float:z,Float:a;
if (
max_cars{playerid} >= MAX_INFERNUS) return SendClientMessage(playerid, -1" You can't spawn more than 5 Infernus car! ");
const 
distance 5;
GetPlayerPos(playerid,x,y,z),GetPlayerFacingAngle(playerid,a);
x+=distance*floatsin(-a,degrees),y+=distance*floatcos(-a,degrees);
max_cars{playerid}++;
CreateVehicle(411,x,y,z,1,1,1,1000); 



Re: Help - ZToPMaN - 31.07.2015

I made a dilaog, Iam tring to make max infernus = 5 and made the sultan as well, so I just want only max infernus 5 , so I want just add max 5,
thanks


Re: Help - ZToPMaN - 31.07.2015

the limit not working .-.


Re: Help - liquor - 31.07.2015

TOP

pawn Код:
// TOP OF SCRIPT
new infernusspawned[MAX_PLAYERS]; // the variable is already 0.

// Each time you spawn an infernus
if(infernusspawned[playerid] >= 5) return SendClientMessage(playerid,-1,"Error: You have reached your Infernus quota.");
infernusspawned[playerid]++;
// create vehicle and all that.
All you need


Re: Help - ZToPMaN - 31.07.2015

ty pro


AW: Help - Kaliber - 31.07.2015

Kidding?! it's the same code

seems you can't copy & paste


Re: Help - ZToPMaN - 31.07.2015

god i was coping it wrong :P my bad