[Help Please] OnPlayerRequestClass
#1

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

Use SpawnPlayer() in OnPlayerDeath.
Reply
#3

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

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
}
Reply
#5

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

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

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 !
Reply
#8

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.
Reply
#9

Код:
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.
Reply
#10

What did you do?

Also, you forgot a bracket.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)