OnPlayerDeath e OnPlayerSpawn problem
#1

Hello! I have a problem with my GameMode. I would that when a player dies, it will be spawned. But in my GameMode, when a player dies, it doesn't spawn and the main screen "<< >> Spawn" appears (and sometimes, players has a bottle or a cigar in the hand). Here the script:

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,100);
    GivePlayerWeapon(playerid,3,1);
    GivePlayerWeapon(playerid,24,140);
    GivePlayerWeapon(playerid,25,20);
    GivePlayerWeapon(playerid,29,350);
    GivePlayerWeapon(playerid,41,1000);
    //TextDrawShowForPlayer(playerid,Orologio);
    //gettime(Ore,Minuti);
    //SetPlayerTime(playerid,Ore,Minuti);
    return 1;
}
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);
    //TextDrawHideForPlayer(playerid,Orologio);
    SalvaStats(playerid);
    return 1;
}
SalvaStats(playerid) function:
pawn Код:
stock SalvaStats(playerid)
{
    format(query,sizeof(query),"UPDATE `users` SET `Rango` = '%s', `Gruppo` = '%d', `Skin` = '%d', `LastLoginInGame` = '%s', `Ban` = '%d', `Ip` = '%s' WHERE `Username` = '%s'",stats[playerid][Rango],stats[playerid][Gruppo],stats[playerid][Skin],stats[playerid][LastLoginInGame],stats[playerid][ban],stats[playerid][Ip],stats[playerid][Username]);
    mysql_query(query);
}
How can I fix that? Thank you in advance!
(And sorry for my English)
Reply
#2

Most of the times, you get a bottle or a cigarette when you spawn a player after OnPlayerRequestClass has been called. Would you mind show us your OnPlayerRequestClass callback?

And make sure that none of your modes use ForceClassSelection.
Reply
#3

Look here:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    return 0;
}
I have to return 1?
Reply
#4

Yes.

Quote:

Returning 0 in this callback will prevent the player from spawning.

That's why it doesn't spawn the player. And if it does, the bug I described above happens.
Reply
#5

Solved. Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)