SA-MP Forums Archive
[Help]Not sure how to script this - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help]Not sure how to script this (/showthread.php?tid=147247)



[Help]Not sure how to script this - bennyisme - 11.05.2010

How can i make a timed spawn like a spawn time so when you try to spawn after like if you come late it will send you to spectating and how do i make a score board(textdraw) of the remaining players of the tdm that are still alive.


Re: [Help]Not sure how to script this - Backwardsman97 - 11.05.2010

Just return 0 under OnPlayerRequestSpawn to make them not be able to spawn for a specified reason.


Re: [Help]Not sure how to script this - coole210 - 11.05.2010

you can make a variable and a timer for the spawning part..

at top of script:

Код:
CanSpawn[MAX_PLAYERS];
OnPlayerConnect:

Код:
CanSpawn(playerid) = 1;
OnPlayerRequestSpawn:

Код:
if(CanSpawn == 0)
{
SendClientMessage(playerid,color,"You cannot spawn yet!");
return 0;
}
OnPlayerDeath:

Код:
CanSpawn = 0;
Then add a timer on onplayerdeath for the amount of secs you want and make the timer change canspawn to 1 so they can spawn


Re: [Help]Not sure how to script this - bennyisme - 11.05.2010

Quote:
Originally Posted by [TPG
Coole210 ]
you can make a variable and a timer for the spawning part..

at top of script:

Код:
CanSpawn[MAX_PLAYERS];
OnPlayerConnect:

Код:
CanSpawn(playerid) = 1;
OnPlayerRequestSpawn:

Код:
if(CanSpawn == 0)
{
SendClientMessage(playerid,color,"You cannot spawn yet!");
return 0;
}
OnPlayerDeath:

Код:
CanSpawn = 0;
Then add a timer on onplayerdeath for the amount of secs you want and make the timer change canspawn to 1 so they can spawn
But i want to make it so if they come late they can't spawn till gamemode is over and just spectate some players. Not timed for when they can spawn. Anyways thanks for that script.


Re: [Help]Not sure how to script this - coole210 - 11.05.2010

Okay make 3 timers

1 30 mins for example (gamemode ends)

1 27 mins for example (setting a variable to 1 meaning the 3rd timer can be activated)

1 3 mins for example (Making all people that connect & spawn wait 3 minutes in spectating mode)






Re: [Help]Not sure how to script this - bennyisme - 11.05.2010

okay.. where do i put the timers? could you post an example please :O


Re: [Help]Not sure how to script this - coole210 - 11.05.2010

Код:
new gmend;
new gmlate;
new cantspawn;
then set the gmend timer in ongamemodeinit make a forward & public function for it

set gmlate timer at ongamemodeinit and do the same as gmend but just set a variable in it

set cantspawn timer when the variable in gmlate is activated

Need any further help about timers? Use the good old sa-mp wiki:

Код:
https://sampwiki.blast.hk/wiki/SetTimer
Код:
https://sampwiki.blast.hk/wiki/SetTimerEx



Re: [Help]Not sure how to script this - bennyisme - 11.05.2010

ya i got that i need a timer but when i put time example:
new Timer;
Код:
public GameModeInit()
{
    SetTimer("Timer", 30000, 0);
}

public Timer()
{
  TogglePlayerSpectating(playerid, 1);
  PlayerSpectatePlayer(playerid, killerid);
}
then when timer runs out it just turns to spectating(not sure what variable to put)


Re: [Help]Not sure how to script this - bennyisme - 11.05.2010

bumb


Re: [Help]Not sure how to script this - bennyisme - 12.05.2010

help me please