SA-MP Forums Archive
kname,playerid? - 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: kname,playerid? (/showthread.php?tid=259824)



kname,playerid? - ...:Lucian:... - 06.06.2011

Well yes I want to do when the guy uses animation to defend them in chat

Lucian (2) Pisses On NaB(0)

and do not know how to do so and I see it's just as IDs and names as

I did so at first order

Quote:

new kName[ MAX_PLAYER_NAME ], string[ 256 ];
GetPlayerName(playerid, kName, sizeof(kName));

on command

Quote:

if(strcmp(cmd, "/piss", true) == 0)
{
SetPlayerSpecialAction(playerid, 6; // not defined in a_players.inc, so it's just the ID.
format(string, sizeof(string), "%s (%d) Pisses On %s(%d)", kName,playerid);
SendClientMessageToAll(0xFFFFFFAA,string);
return 1;
}

that's only occur when the same id and name
and I tried it but will not work

Quote:

if(strcmp(cmd, "/piss", true) == 0)
{
SetPlayerSpecialAction(playerid, 6; // not defined in a_players.inc, so it's just the ID.
format(string, sizeof(string), "%s (%d) Pisses On %s(%d)", kName,playerid),kname,playerid;
SendClientMessageToAll(0xFFFFFFAA,string);
return 1;
}

and it compiles but I kept my id name if I could do when no one beside me to defend him just grind and grind when someone like him can do


Re: kname,playerid? - Basicz - 06.06.2011

Like this? Untested and didn't compiled it yet...

pawn Код:
if ( !strcmp( cmdtext, "/piss", true ) )
{
    new iTarget;

    SetPlayerSpecialAction( playerid, 6 );

    new Float: iPos[ 3 ];

    GetPlayerPos( playerid, iPos[ 0 ], iPos[ 1 ], iPos[ 2 ] );

    // IMPORTANT: I use foreach.

    foreach (Player, i )
    {
         if( IsPlayerInRangeOfPoint( i, 2.0, iPos[ 0 ], iPos[ 1 ], iPos[ 2 ] ) )
         {
              iTarget = i;
         }
    }

    new iName[ 24 ];

    GetPlayerName( iTarget, iName, sizeof iName );

    new kName[ 24 ];

    GetPlayerName( playerid, kName, sizeof kName );

    new szString[ 128 ];

    format( szString, sizeof szString, "%s ( %d ) pisses on %s ( %d )",  kName, playerid, iName, iTarget );

    SendClientMessageToAll( 0xFFFFFFAA, szString );

    return 1;
}



Re: kname,playerid? - ...:Lucian:... - 06.06.2011

Код:
D:\G@MES (Lucian™)\GTA San Andreas\LS Gang War\filterscripts\actions.pwn(213) : error 017: undefined symbol "stcmp"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: kname,playerid? - Basicz - 06.06.2011

Change stcmp to strcmp. Fixed!


Re: kname,playerid? - ...:Lucian:... - 06.06.2011

Quote:
Originally Posted by Basicz
Посмотреть сообщение
Change stcmp to strcmp. Fixed!
th'x is work
but i have one a question
home can change
ok
i use /piss and said
Lucian (o) pissed on Lucian (0)

how can if there's no one beside me
how can change Lucian (0) Pisses. (this is for no on some one)
and for some one guy Lucian (0) pisses on Nab(1)

Can help me plz


Re: kname,playerid? - [L3th4l] - 06.06.2011

Change this:
pawn Код:
foreach (Player, i )
    {
         if( IsPlayerInRangeOfPoint( i, 2.0, iPos[ 0 ], iPos[ 1 ], iPos[ 2 ] ) )
         {
              iTarget = i;
         }
    }
To this:
pawn Код:
foreach (Player, i )
    {
         if( IsPlayerInRangeOfPoint( i, 2.0, iPos[ 0 ], iPos[ 1 ], iPos[ 2 ] ) && playerid != i )
         {
              iTarget = i;
         }
    }
Edit: Didn't see the rest of your request, try this:
pawn Код:
if(!strcmp(cmdtext, "/piss", true))
{
    new
        iTarget;

    new
        Float:iPos[3];

    GetPlayerPos(playerid, iPos[0], iPos[1], iPos[2]);
   
    new
        pName[MAX_PLAYER_NAME],
        iTargetName[MAX_PLAYER_NAME],
        iStr[75];

    GetPlayerName(playerid, pName, sizeof(pName));
   
    foreach(Player, i)
    {
        if(IsPlayerInRangeOfPoint(i, 2.0, iPos[0], iPos[1], iPos[2]) && playerid != i)
        {
            iTarget = i;

            GetPlayerName(iTarget, iTargetName, sizeof(iTargetName));
            format(iStr, sizeof(iStr), "%s(%d) pisses on %s(%d)", pName, playerid, iTargetName, iTarget);
        }
        else format(iStr, sizeof(iStr), "%s(%d) pisses.", pName, playerid);
    }
    return SetPlayerSpecialAction(playerid, 6), SendClientMessageToAll(-1, iStr);
}



Re: kname,playerid? - Basicz - 06.06.2011

Didn't see Lethal's post! Use his script, that's more quicker than mine!


Re: kname,playerid? - ...:Lucian:... - 06.06.2011

Quote:
Originally Posted by ...:Lucian:...
Посмотреть сообщение
th'x is work
but i have one a question
home can change
ok
i use /piss and said
Lucian (o) pissed on Lucian (0)

how can if there's no one beside me
how can change Lucian (0) Pisses. (this is for no on some one)
and for some one guy Lucian (0) pisses on Nab(1)

Can help me plz
can help me with this