Help OnPlayerDeath
#1

Hi guys i've make dm arena
Код HTML:
COMMAND:dmpirate(playerid, params[])
{
     new string[600],pname[MAX_PLAYER_NAME];
     GetPlayerName(playerid, pname, sizeof(pname)); 
     if(IsPlayerInDM[playerid] == 1) return SendClientMessage(playerid, COLOR_ORANGE, "Tu es deja dans le dm Pirate, fait /dmpirateq pour le quitter");
     IsPlayerInDM[playerid] = 1; 
     format(string, sizeof(string), "%s A rejoint le /dmpirate, rejoignez le !", pname);
     SendClientMessageToAll(COLOR_ORANGE, string);
     SendClientMessage(playerid, COLOR_ORANGE, "Tu as rejoint le dm pirate");
     SetPlayerPos(playerid, -2050.0810547,-7609.0312500,2.2020721);
     ResetPlayerWeapons(playerid);
	 GivePlayerWeapon(playerid, 26, 900);
	 GivePlayerWeapon(playerid, 24, 900);
     SetPlayerFacingAngle(playerid, 0);
     return 1;
}
But when the player dead he don't respawn at, i've tried lots of code in "OnPlayerDeath" but that don't work, have u solutions ?

Srry for my bad english #France
Reply
#2

Hi.
Try this :
If IsPlayerInDM[playerid] = 1, then SetPlayerPos(playerid, -2050.0810547,-7609.0312500,2.2020721);
Reply
#3

new string[600] ;
No. Never. Ever.

pawn Код:
//TOP OF SCRIPT
new bool: IsPlayerInDM[MAX_PLAYERS]; // 0 = false, 1 = true.

CMD:dmpirate(playerid, params[]) // If CMD Doesn't work replace with COMMAND
{
     new string[128], pname[MAX_PLAYER_NAME]; // The larger the string, the larger the file, in result the more lag.
     GetPlayerName(playerid, pname, sizeof(pname));
     if(IsPlayerInDM[playerid] == true) return SendClientMessage(playerid, COLOR_ORANGE, "Tu es deja dans le dm Pirate, fait /dmpirateq pour le quitter");
     IsPlayerInDM[playerid] = true;
     format(string, sizeof(string), "%s A rejoint le /dmpirate, rejoignez le !", pname);
     SendClientMessageToAll(COLOR_ORANGE, string);
     SendClientMessage(playerid, COLOR_ORANGE, "Tu as rejoint le dm pirate");
     SetPlayerPos(playerid, -2050.0810547,-7609.0312500,2.2020721);
     ResetPlayerWeapons(playerid);
     GivePlayerWeapon(playerid, 26, 900);
     GivePlayerWeapon(playerid, 24, 900);
     SetPlayerFacingAngle(playerid, 0);
     return 1;
}


PF: OnPlayerSpawn(playerid)
{
    if(IsPlayerInDM[playerid] == true)
    {
        SetPlayerPos(playerid, -2050.0810547,-7609.0312500,2.2020721);
        GivePlayerWeapon(playerid, 26, 900);
        GivePlayerWeapon(playerid, 24, 900);
        SetPlayerFacingAngle(playerid, 0);
    }
    else {
        // Place Current spawn info here. Outside of DM
    }
    return true;
}
Reply
#4

Whuut?
PHP код:
PFOnPlayerSpawn(playerid)
{
    if(
IsPlayerInDM[playerid] == true)
    {
        
SetPlayerPos(playerid, -2050.0810547,-7609.0312500,2.2020721);
        
GivePlayerWeapon(playerid26900);
            
GivePlayerWeapon(playerid24900);
        
SetPlayerFacingAngle(playerid0);
    }
    else {
        
// Place Current spawn info here. Outside of DM
    
}
    return 
true;

This is better, no?
PHP код:
public OnPlayerSpawn(playerid)
{
    if(
IsPlayerInDM[playerid])
    {
        
SetPlayerPos(playerid, -2050.0810547,-7609.0312500,2.2020721);
        
GivePlayerWeapon(playerid26900);
        
GivePlayerWeapon(playerid24900);
        
SetCameraBehindPlayer(playerid);
    }
    return 
1;

Reply
#5

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Whuut?
PHP код:
PFOnPlayerSpawn(playerid)
{
    if(
IsPlayerInDM[playerid] == true)
    {
        
SetPlayerPos(playerid, -2050.0810547,-7609.0312500,2.2020721);
        
GivePlayerWeapon(playerid26900);
        
GivePlayerWeapon(playerid24900);
        
SetPlayerFacingAngle(playerid0);
    }
    else {
        
// Place Current spawn info here. Outside of DM
    
}
    return 
true;

This is better, no?
PHP код:
public OnPlayerSpawn(playerid)
{
    if(
IsPlayerInDM[playerid])
    {
        
SetPlayerPos(playerid, -2050.0810547,-7609.0312500,2.2020721);
        
GivePlayerWeapon(playerid26900);
        
GivePlayerWeapon(playerid24900);
        
SetPlayerFacingAngle(playerid0);
    }
    return 
1;

No.
if(IsPlayerInDM[playerid])
That's not returning true, nor false.
Reply
#6

Quote:
Originally Posted by Lynn
Посмотреть сообщение
No.
if(IsPlayerInDM[playerid])
That's not returning true, nor false.
No? It will bro.
if(IsPlayerInDM[playerid]) = if(IsPlayerInDM[playerid] == true)
if(!IsPlayerInDM[playerid]) = if(IsPlayerInDM[playerid] == false)
Reply
#7

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
No? It will bro.
if(IsPlayerInDM[playerid]) = if(IsPlayerInDM[playerid] == true)
if(!IsPlayerInDM[playerid]) = if(IsPlayerInDM[playerid] == false)
pawn Код:
IsPlayerInDM[playerid] // The variable.
if(IsPlayerInDM[playerid] == AMOUNT) // The numeric value the variable is equal to.
By your logic, you'd be asking if the variable solely exists
That's like saying
if(Variable[playerid])
is the same as
if(Variable[playerid] == 949586)
Reply
#8

You might want to use SetSpawnInfo.
Reply
#9

Quote:
Originally Posted by Lynn
Посмотреть сообщение
pawn Код:
IsPlayerInDM[playerid] // The variable.
if(IsPlayerInDM[playerid] == AMOUNT) // The numeric value the variable is equal to.
By your logic, you'd be asking if the variable solely exists
That's like saying
if(Variable[playerid])
is the same as
if(Variable[playerid] == 949586)
Actually
Код:
if (Variable[playerid])
is the same as
Код:
if (Variable[playerid] > 0)
And
Код:
if (!Variable[playerid])
is the same as
Код:
if (Variable[playerid] == 0)
Reply
#10

Thanks guys it's working !
I have an other question, i've tried to find by myself but without sucess. When the Player is in dm he can /spawn... How can I Restrict command with a message (ex:" You can't use thay cmd when ur in a dm")
Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)