After death
#1

If the player dies in the Paintball I made, he respawns at the spawning point where he spawned in the login.
So, how do I make it like, when he dies in the Paintball area, he keep respawning in the Paintball area until he leaves the paintball area.
code:

PHP код:
if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playeridCOLOR_RED"Error: You need $1000 to enter the Paintball area.");
                
GivePlayerMoney(playerid, -1000);
                
SetPlayerPos(playerid, -975.975708,1060.983032,1345.671875);
                
SendClientMessage(playeridCOLOR_YELLOW"You have entered the Paintball area, have fun!");
                
SetPlayerVirtualWorld(playeridVW_PAINTBALL);
                
SetPlayerInterior(playerid10); 
If more codes are needed, feel free to ask.

Edit: I atleast tried it, but its bugged as hell, so keep sticked to my question.
The tried thingy;;
PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    if(
GetPlayerInterior(playerid) == 10)
    
SetSpawnInfo(playerid00, -975.975708,1060.983032,1345.671875270245000025500002850000);
    
SetPlayerPos(playerid, -975.975708,1060.983032,1345.671875);
    
SetPlayerVirtualWorld(playeridVW_PAINTBALL);
    
SetPlayerInterior(playerid10);
    
SendDeathMessage(killeridplayeridreason); 
Reply
#2

Instead of SetPlayerInterior , use a variable that defined before. like IsPlayerInPB[playerid] = 1;
And use it in OnPlayerDeath like if(IsPlayerInPB[playerid] == 1)
It will definitely work
Reply
#3

In addition to what is said above, I don't think so that SetPlayerPos and SetSpawnInfo works in OnPlayerDeath use that SetPlayerPos code inside OnPlayerSpawn not in OnPlayerDeath.
Reply
#4

Quote:
Originally Posted by Alpay0098
Посмотреть сообщение
Instead of SetPlayerInterior , use a variable that defined before. like IsPlayerInPB[playerid] = 1;
And use it in OnPlayerDeath like if(IsPlayerInPB[playerid] == 1)
It will definitely work
A boolean would be better.
Reply
#5

pawn Код:
new bool:InPaintball[MAX_PLAYERS];

//OnPlayerConnect, On player exit paintball
{
    InPaintball[playerid] = false;
}
//On player enter paintball
                if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, COLOR_RED, "Error: You need $1000 to enter the Paintball area.");
                GivePlayerMoney(playerid, -1000);
                SetPlayerPos(playerid, -975.975708,1060.983032,1345.671875);
                SendClientMessage(playerid, COLOR_YELLOW, "You have entered the Paintball area, have fun!");
                SetPlayerVirtualWorld(playerid, VW_PAINTBALL);
                SetPlayerInterior(playerid, 10);
                InPaintball[playerid] = true;
               
//OnPlayerSpawn
if(InPaintball[playerid])
{
    SetPlayerPos(playerid, -975.975708,1060.983032,1345.671875);
    SetPlayerVirtualWorld(playerid, VW_PAINTBALL);
    SetPlayerInterior(playerid, 10);
    SendDeathMessage(killerid, playerid, reason);
}
Reply
#6

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
pawn Код:
new bool:InPaintball[MAX_PLAYERS];

//OnPlayerConnect, On player exit paintball
{
    InPaintball[playerid] = false;
}
//On player enter paintball
                if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, COLOR_RED, "Error: You need $1000 to enter the Paintball area.");
                GivePlayerMoney(playerid, -1000);
                SetPlayerPos(playerid, -975.975708,1060.983032,1345.671875);
                SendClientMessage(playerid, COLOR_YELLOW, "You have entered the Paintball area, have fun!");
                SetPlayerVirtualWorld(playerid, VW_PAINTBALL);
                SetPlayerInterior(playerid, 10);
                InPaintball[playerid] = true;
               
//OnPlayerSpawn
if(InPaintball[playerid])
{
    SetPlayerPos(playerid, -975.975708,1060.983032,1345.671875);
    SetPlayerVirtualWorld(playerid, VW_PAINTBALL);
    SetPlayerInterior(playerid, 10);
    SendDeathMessage(killerid, playerid, reason);
}
//OnPlayerSpawn
PHP код:
if(InPaintball[playerid] == 1)
{
    
SetPlayerPos(playerid, -975.975708,1060.983032,1345.671875);
    
SetPlayerVirtualWorld(playeridVW_PAINTBALL);
    
SetPlayerInterior(playerid10);
    
SendDeathMessage(killeridplayeridreason);

Reply
#7

Quote:
Originally Posted by KillerDVX
Посмотреть сообщение
//OnPlayerSpawn
PHP код:
if(InPaintball[playerid] == 1)
{
    
SetPlayerPos(playerid, -975.975708,1060.983032,1345.671875);
    
SetPlayerVirtualWorld(playeridVW_PAINTBALL);
    
SetPlayerInterior(playerid10);
    
SendDeathMessage(killeridplayeridreason);

Nope, Mine is correct, try it
Reply
#8

Hm.. you can check the variable with both : true or 1.
Reply
#9

Yes, there was no reason to rewrite it then...
Reply
#10

xCIP3Rx, I tried your code. it doesn't give any errors but, it still respawns at the login spawn place.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)