SA-MP Forums Archive
[Help Please] OnPlayerRequestClass - 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 Please] OnPlayerRequestClass (/showthread.php?tid=191845)



[Help Please] OnPlayerRequestClass - XoSarahMoX - 20.11.2010

Hi ,

I wanted to know if it is possible to do something like this:

If the player is dead, they cant go to the OnPlayerRequestClass?

Please help if you know how to do this !

Thank you


Re: [Help Please] OnPlayerRequestClass - rs.pect - 20.11.2010

Use SpawnPlayer() in OnPlayerDeath.


Re: [Help Please] OnPlayerRequestClass - XoSarahMoX - 20.11.2010

Yeah but I dont want the person to spawn on death since I have a hospital system and I dont want them not to go to the hospital after death :O


Re: [Help Please] OnPlayerRequestClass - Steven82 - 20.11.2010

make a variable. ex.

pawn Код:
new Dead[MAX_PLAYERS];

OnPlayerDeath
{
 Dead = 1;
 if(Dead == 1)
 {
   SetPlayerPos(x,y,z);
   SetPlayerInterior(coding here) // thats if your spawning them in an interior
}



Re: [Help Please] OnPlayerRequestClass - XoSarahMoX - 20.11.2010

I added that onplayerdeath and I just got a lot of errors , sorry im new to scripting stuff :/


Re: [Help Please] OnPlayerRequestClass - Proxyded - 20.11.2010

use SpawnPlayer() on OnPlayerRequestClass
If you got a login(account) system, check if the player is logged in.

Something like:
Код:
public OnPlayerRequestClass(playerid, classid)
{
	if(PlayerVariable[logged] == 1) 
	{
		SpawnPlayer();
	}
	return 1;
}
The basic idea is, if a player reaches the Class Selection, he will automatically spawn.


Re: [Help Please] OnPlayerRequestClass - XoSarahMoX - 20.11.2010

Is it possible to spawn him in his last known positation? Maybe like?

GetPlayerPos or something and then make it SetPlayerPos to those Coords? I dont know the right stuff to put though so please give me the code if its possible thanks !


Re: [Help Please] OnPlayerRequestClass - The_Moddler - 20.11.2010

pawn Код:
new Float: X[MAX_PLAYERS], Float: Y[MAX_PLAYERS], Float: Z[MAX_PLAYERS];

public OnPlayerDeath(killerid, playerid)
{
    GetPlayerPos(playerid, X[playerid], Y[playerid], Z[playerid]);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid, X[playerid], Y[playerid], Z[playerid]);
    return 1;
}
He will go to his last pos.


Re: [Help Please] OnPlayerRequestClass - XoSarahMoX - 20.11.2010

Код:
forward respawntimes();
new Float: X[MAX_PLAYERS], Float: Y[MAX_PLAYERS], Float: Z[MAX_PLAYERS];
public OnPlayerRequestClass(playerid, classid)
{
	if(PlayerVariable[logged] == 1)
	{
    GetPlayerPos(playerid, X[playerid], Y[playerid], Z[playerid]);
	SetTimer("respawntime" 3500, 0);
	return 1;
}

public respawntime(playerid);
{
	SetPlayerPos(playerid, X[playerid], Y[playerid], Z[playerid]);
	return 1;
}
What am I doing wrong there ? Please Help I get these error btw:
Код:
C:\Users\SoSu\Desktop\SAMP Server\gamemodes\rptrain.pwn(106) : error 017: undefined symbol "PlayerVariable"
C:\Users\SoSu\Desktop\SAMP Server\gamemodes\rptrain.pwn(106) : error 017: undefined symbol "logged"
C:\Users\SoSu\Desktop\SAMP Server\gamemodes\rptrain.pwn(106) : error 029: invalid expression, assumed zero
C:\Users\SoSu\Desktop\SAMP Server\gamemodes\rptrain.pwn(106) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: [Help Please] OnPlayerRequestClass - The_Moddler - 20.11.2010

What did you do?

Also, you forgot a bracket.