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



Respawn - Akcent_Voltaj - 21.01.2013

toate masinile au fost respawnate = spams.(RO/ENG): all cars where respawned.If you need rep,il give you rep!


PHP код:
            public ScheduledRespawn(playerid)
                    {
                    new 
bool:unwanted[CAR_AMOUNT];
                    for(new 
0MAX_PLAYERSi++)
                    {
                        for(new 
player=0player<MAX_PLAYERSplayer++)
                    {
                    if(
IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
                    }
                    }
                    for(new 
car 1car <= 359car++)
                    {
                        if(!
unwanted[car]) SetVehicleToRespawn(car);
                    }
                    
SendClientMessage(playerid,COLOR_YELLOW,"• Toate masinile au fost respawnate ! •");
                    } 



Re: Respawn - azzerking - 21.01.2013

Want he wants is a function that will reset all the vehicles that are currently not occupied. But i'm guessing this is on a timer or at a certain time. Example (12:00pm, Reset All Vehicles).

Also yes, its not very clear so next time please fix up your English or goto the foreign section of the forums.


Re: Respawn - Akcent_Voltaj - 21.01.2013

what am i not clear?that message spams..thats all..yes i have timer..you dont need timer..do you?


Re: Respawn - azzerking - 21.01.2013

I wouldn't use a timer for this.

Id use get time.
pawn Код:
getTime();
and then check to see if time is equal to a specif time.

pawn Код:
new Time = getTime();

if(Time == "12:00")
{
      RespawnVehicles();
}
Info
I'm very tired, so im not sure if, im right. If i'm wrong then im sorry and I will continue to help


Re: Respawn - Akcent_Voltaj - 21.01.2013

no..i want how i posted..sorry..please help..


Re: Respawn - azzerking - 21.01.2013

Your post is misleading then. As that's how I understood it. Please rewrite it in as much english as you can.


Re: Respawn - Akcent_Voltaj - 21.01.2013

ok.Whats so hard to understand

this message spams: SendClientMessage(playerid,COLOR_YELLOW,"• Toate masinile au fost respawnate ! •");

im not writing in chineese..


Re: Respawn - arakuta - 21.01.2013

Use a IsPlayerConnected condition before.


Re: Respawn - Akcent_Voltaj - 21.01.2013

you sure?wow..test it..you tell me stupid stuff..X(

Quote:

public ScheduledRespawn(playerid)
{
if(IsPlayerConnected(playerid))
{
new bool:unwanted[CAR_AMOUNT];
for(new i = 0; i < MAX_PLAYERS; i++)
{
for(new player=0; player<MAX_PLAYERS; player++)
{
if(IsPlayerInAnyVehicle(player))
{
unwanted[GetPlayerVehicleID(player)]=true;
}
for(new car = 1; car <= 359; car++)
{
if(!unwanted[car]) SetVehicleToRespawn(car);
}
SendClientMessage(playerid,COLOR_YELLOW,"• Toate masinile au fost respawnate ! •");
}
}
}
}

Quote:

public SyncTime()
{
new string[64];
new tmphour;
new tmpminute;
new tmpsecond;
gettime(tmphour, tmpminute, tmpsecond);
if ((tmphour > ghour) || (tmphour == 0 && ghour == 23))
{
format(string, sizeof(string), "Este ora Fix Ceasul acuma este: %d:00 Succes incontinuare!",tmphour);
BroadCast(COLOR_WHITE,string);
ghour = tmphour;
PayDay();
if (realtime)
{
SetWorldTime(tmphour);
}
for(new i=0; i<MAX_PLAYERS; i++)
{
SendClientMessage( i, COLOR_YELLOW, "• In 20 secunde toate masinile se vor respawna ! •");
}
SetTimer("ScheduledRespawn",20000,false);
}
}




Re: Respawn - Threshold - 21.01.2013

So basically... you created a loop, inside a loop, for the exact same thing, players...
Put this under OnGameModeInit/OnFilterScriptInit:
pawn Код:
public OnGameModeInit()
{
    SetTimer("ScheduledRespawn", time, true); //Change time to your wanted time span
    return 1;
}
Replace 'time' with the duration you want the cars to respawn in... (Example: 1 minute = 60 * 1000 = 60000)

pawn Код:
forward ScheduledRespawn();
public ScheduledRespawn()
{
    new bool:unwanted[MAX_VEHICLES];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInAnyVehicle(i))
        {
            unwanted[GetPlayerVehicleID(i)] = true;
        }
    }
    for(new car = 0; car < MAX_VEHICLES; car++)
    {
        if(!unwanted[car])
        {
            SetVehicleToRespawn(car);
        }
    }
    SendClientMessageToAll(COLOR_YELLOW,"• Toate masinile au fost respawnate ! •");
}
And I wouldn't be calling other people stupid when you can't make a simple car respawner for yourself. Be nice to the people who actually WANT to help you.