SA-MP Forums Archive
Command works only for 1 player. WTF? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Command works only for 1 player. WTF? (/showthread.php?tid=187951)



Command works only for 1 player. WTF? - ZamaXor - 05.11.2010

I have a command that when player types /piss it says "Player pisses on player". When other player types piss it not says "player pisses on player" wtf? When other player types /piss, only the animation appeal, not the format message.

pawn Код:
dcmd_piss(playerid, params[]){
    #pragma unused params
    SetPlayerSpecialAction(i, SPECIAL_ACTION_PISSING);
    new Float: POS[3];
    new player1, playername[MAX_PLAYER_NAME], pissername[MAX_PLAYER_NAME];
    GetPlayerPos(player1, POS[0], POS[1], POS[2]);
    if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid){
       if(IsPlayerInRange(player1, 2, 2, POS[0], POS[1], POS[2])){
          GetPlayerName(player1, playername, sizeof(playername));
          GetPlayerName(playerid,pissername,sizeof(pissername));
          new stringS[100];
          format(stringS,sizeof(stringS),"* %s pisses on %s.",pissername,playername);
          SendClientMessageToAll(COLOR_PINK, stringS);
       }
    }
    return 1;
}



Re: Command works only for 1 player. WTF? - The_Moddler - 05.11.2010

Show the hole command.. that's just a part.


Re: Command works only for 1 player. WTF? - ZamaXor - 05.11.2010

Quote:
Originally Posted by The_Moddler
Посмотреть сообщение
Show the hole command.. that's just a part.
pawn Код:
dcmd_piss(playerid, params[]){
    #pragma unused params
    SetPlayerSpecialAction(i, SPECIAL_ACTION_PISSING);
    new Float: POS[3];
    new player1, playername[MAX_PLAYER_NAME], pissername[MAX_PLAYER_NAME];
    GetPlayerPos(player1, POS[0], POS[1], POS[2]);
    if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid){
       if(IsPlayerInRange(player1, 2, 2, POS[0], POS[1], POS[2])){
          GetPlayerName(player1, playername, sizeof(playername));
          GetPlayerName(playerid,pissername,sizeof(pissername));
          new stringS[100];
          format(stringS,sizeof(stringS),"* %s pisses on %s.",pissername,playername);
          SendClientMessageToAll(COLOR, stringS);
       }
    }
    return 1;
}



Re: Command works only for 1 player. WTF? - ZamaXor - 05.11.2010

bump. Will someone help me to fix this cmd?


Re: Command works only for 1 player. WTF? - MadeMan - 05.11.2010

pawn Код:
dcmd_piss(playerid, params[])
{
    #pragma unused params
    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_PISSING);
    new playername[MAX_PLAYER_NAME], pissername[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pissername,sizeof(pissername));
    new stringS[100];
    new Float: POS[3];
    GetPlayerPos(playerid, POS[0], POS[1], POS[2]);
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && i != playerid)
        {
            if(IsPlayerInRange(i, 2, 2, POS[0], POS[1], POS[2]))
            {
                GetPlayerName(i, playername, sizeof(playername));
                format(stringS,sizeof(stringS),"* %s pisses on %s.",pissername,playername);
                SendClientMessageToAll(COLOR_PINK, stringS);
            }
        }
    }
    return 1;
}