PDA

View Full Version : Help


ZToPMaN
31/07/2015, 12:12 PM
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>

Kaliber
31/07/2015, 12:17 PM
Do it like this :)

//@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);

ZToPMaN
31/07/2015, 12:22 PM
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 :D

ZToPMaN
31/07/2015, 01:50 PM
the limit not working .-.

liquor
31/07/2015, 02:00 PM
TOP


// 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 :)

ZToPMaN
31/07/2015, 02:13 PM
ty pro

Kaliber
31/07/2015, 02:22 PM
Kidding?! it's the same code :D

seems you can't copy & paste :rolleyes:

ZToPMaN
31/07/2015, 03:19 PM
god i was coping it wrong :P my bad :D