OnPlayerDeath Help
#1

Deleted
Reply
#2

pawn Код:
new hospital[MAX_PLAYERS];


public OnPlayerDeath(playerid, killerid, reason)
{
    hospital[playerid] = 1;
    return 1
}
public OnPlayerDisconnect(playerid, reason)
{
    hospital[playerid] = 0;
    return 1
}
public OnPlayerConnect(playerid)
{
    hospital[playerid] = 0;
    return 1;
}
public OnPlayerSpawn(playerid)
{
    if(hospital[playerid] == 1)
    {
        SendClientMessage(playerid, 0xFFFF00AA, "you have lost 30minutes of your memory");
        SetPlayerPos(playerid, 2033.8688,-1405.2469,17.238;
        SetPlayerFacingAngle(playerid, 158.3622);
        SetPlayerHealth(playerid, 100);
        hospital[playerid] = 0;
    }
    return 1;
}
Reply
#3

Creates a timer if you put a message like that, just a tip, change the message to "you have lost 5 minutes of your memory," and oh yes the player leaves the hospital ^^, if it is getting more realistic server to RP

pawn Код:
forward TimeHosp(playerid);

public TimeHosp(playerid)
{
     TogglePlayerControllable(playerid,0);
     SendClientMessage(playerid, 0xFFFFFFFF, "You Are Being Cured... Please Wait");
     return 1;
}
In The OnPlayerDeath :

pawn Код:
SetTimerEx("TimeHosp", 300000, false, "i", playerid);
TogglePlayerControllable(playerid,1);
Is there a hint for you
Reply
#4

FuneraL I did that and it didnt change anything
Reply
#5

pawn Код:
forward TimeHosp(playerid);

new hospital[MAX_PLAYERS];


public OnPlayerDeath(playerid, killerid, reason)
{
    hospital[playerid] = 1;
    return 1
}
public OnPlayerDisconnect(playerid, reason)
{
    hospital[playerid] = 0;
    return 1
}
public OnPlayerConnect(playerid)
{
    hospital[playerid] = 0;
    return 1;
}
public TimeHosp(playerid)
{
     TogglePlayerControllable(playerid,0);
     SendClientMessage(playerid, 0xFFFFFFFF, "You Are Being Cured... Please Wait");
     return 1;
}
public OnPlayerSpawn(playerid)
{
    if(hospital[playerid] == 1)
    {
        SetTimerEx("TimeHosp", 300000, false, "i", playerid);
        TogglePlayerControllable(playerid,1);        
        SendClientMessage(playerid, 0xFFFF00AA, "you have lost 5 minutes of your memory");
        SetPlayerPos(playerid, 2033.8688,-1405.2469,17.238;
        SetPlayerFacingAngle(playerid, 158.3622);
        SetPlayerHealth(playerid, 100);
        hospital[playerid] = 0;
    }
    return 1;
}
Try this.
Reply
#6

public OnPlayerDeath(playerid, killerid, reason)
{
hospital[playerid] = 1;
return 1;
}

i get this

C:\Users\Michael C\Desktop\4-21-2012 project\gamemodes\NewRoleplay.pwn(273) : error 017: undefined symbol "hospital"
C:\Users\Michael C\Desktop\4-21-2012 project\gamemodes\NewRoleplay.pwn(273) : warning 215: expression has no effect
C:\Users\Michael C\Desktop\4-21-2012 project\gamemodes\NewRoleplay.pwn(273) : error 001: expected token: ";", but found "]"
C:\Users\Michael C\Desktop\4-21-2012 project\gamemodes\NewRoleplay.pwn(273) : error 029: invalid expression, assumed zero
C:\Users\Michael C\Desktop\4-21-2012 project\gamemodes\NewRoleplay.pwn(273) : fatal error 107: too many error messages on one line

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

I fixed it for you, look in your PMs
Reply
#8

hospital[playerid] needs defined as a global variable.

Quote:
Originally Posted by Michael_Cuellar
Посмотреть сообщение
public OnPlayerDeath(playerid, killerid, reason)
{
hospital[playerid] = 1;
return 1;
}

i get this

C:\Users\Michael C\Desktop\4-21-2012 project\gamemodes\NewRoleplay.pwn(273) : error 017: undefined symbol "hospital"
C:\Users\Michael C\Desktop\4-21-2012 project\gamemodes\NewRoleplay.pwn(273) : warning 215: expression has no effect
C:\Users\Michael C\Desktop\4-21-2012 project\gamemodes\NewRoleplay.pwn(273) : error 001: expected token: ";", but found "]"
C:\Users\Michael C\Desktop\4-21-2012 project\gamemodes\NewRoleplay.pwn(273) : error 029: invalid expression, assumed zero
C:\Users\Michael C\Desktop\4-21-2012 project\gamemodes\NewRoleplay.pwn(273) : fatal error 107: too many error messages on one line

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

look my post
pawn Код:
new hospital[MAX_PLAYERS];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)