#1

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

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); 
Reply
#3

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
Reply
#4

the limit not working .-.
Reply
#5

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
Reply
#6

ty pro
Reply
#7

Kidding?! it's the same code

seems you can't copy & paste
Reply
#8

god i was coping it wrong :P my bad
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)