#1

I need some help with Giving Players Cars on a timer.
what i did is:

Код:
SetTimer("GiveAllCar",12000,0);

forward GiveAllCar();
public GiveAllCar()
{
     for(new i; i<MAX_PLAYERS; i++)
    {
	    new Car, Float:X,Float:Y,Float:Z,Float:Angle;
	    GetPlayerPos(i,X,Y,Z);
	    GetPlayerFacingAngle(i,Angle);
                 Car= CreateVehicle(411,X,Y,Z,Angle,1,-1,-1);
                 PutPlayerInVehicle(i,Car,0);
    }
}
But when i do this 1 player Gets like 500 Cars and the Server Crash.
I tried also:
Код:
//OnPlayerSpawn
SetTimerEx("GiveAllCar",12000,0,"d",playerid);

forward GiveAllCar(playerid);
public GiveAllCar(playerid)
{
    new Car, Float:X,Float:Y,Float:Z,Float:Angle;
    GetPlayerPos(playerid,X,Y,Z);
    GetPlayerFacingAngle(playerid,Angle);
    Car= CreateVehicle(411,X,Y,Z,Angle,1,-1,-1);
    PutPlayerInVehicle(playerid,Car,0);
}
now on this script sometimes a player dont get a car.

So can someone please help me out?
Thanks!
Reply
#2

Try Using
Код:
SetTimerEx("GiveAllCar",12000,false,"i",playerid);
Reply
#3

pawn Код:
forward GiveAllCar();
public GiveAllCar()
{
    for(new i; i<MAX_PLAYERS; i++)
    {
        new Car, Float:X,Float:Y,Float:Z,Float:Angle;
        GetPlayerPos(i,X,Y,Z);
        GetPlayerFacingAngle(i,Angle);
        Car = CreateVehicle(411,X,Y,Z,Angle,1,-1,-1);
        PutPlayerInVehicle(i,Car,0);
    }
    return 1;
}
OnFilterScriptInit (Or OnGameModeInit):
pawn Код:
SetTimer("GiveAllCar",12000,1);
Cheers!
Reply
#4

Quote:
Originally Posted by clarencecuzz
Посмотреть сообщение
Try Using
Код:
SetTimerEx("GiveAllCar",12000,false,"i",playerid);
I tried this And still sometimes Players dont get Cars.

Quote:
Originally Posted by Jeffry
Посмотреть сообщение
SetTimer("GiveAllCar",12000,1);
I dont want it to repeated.
Reply
#5

You only want to give the player one car, 2 minutes after he/she connects?
Reply
#6

Quote:
Originally Posted by Jeffry
Посмотреть сообщение
You only want to give the player one car, 2 minutes after he/she connects?
No, i have Race GM and when they spawn they get car and when they die they spectate.
Reply
#7

Quote:
Originally Posted by NeverKnow
Посмотреть сообщение
No, i have Race GM and when they spawn they get car and when they die they spectate.
So two minutes after the spawn they get a car, and when they lose it, no more car?
Reply
#8

Quote:
Originally Posted by Jeffry
Посмотреть сообщение
So two minutes after the spawn they get a car, and when they lose it, no more car?
Yes after they spawn the player will get his car and they lose their car when they Burn or get out of car but my problem is only that sometimes some players dont get their car =/
Reply
#9

Bump
Reply
#10

Then what you first posted should actually work.

pawn Код:
//OnPlayerSpawn
SetTimerEx("GiveAllCar",12000,0,"d",playerid);

forward GiveAllCar(playerid);
public GiveAllCar(playerid)
{
    new Car, Float:X,Float:Y,Float:Z,Float:Angle;
    GetPlayerPos(playerid,X,Y,Z);
    GetPlayerFacingAngle(playerid,Angle);
    Car= CreateVehicle(411,X,Y,Z,Angle,1,-1,-1);
    PutPlayerInVehicle(playerid,Car,0);
    return 1;
}
What do you mean by ''sometimes'', does this appear after the server was online for a long time?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)