SA-MP Forums Archive
/playerinfo - 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: /playerinfo (/showthread.php?tid=102760)



/playerinfo - [ATC]eRaZoR - 17.10.2009

Hello,

I search a /playerinfo command, when i use /playerinfo [playerid] than will i see:

- money
- Player IP
- Health + Armour

please help me


Re: /playerinfo - MenaceX^ - 17.10.2009

I myself have seen A LOT, you better search again. In every single admin script you could find it.


Re: /playerinfo - [ATC]eRaZoR - 17.10.2009

I have search, but I don't find it..


Re: /playerinfo - Hiitch - 17.10.2009

Quote:
Originally Posted by MenaceX^
In every single admin script you could find it.
Use stuff like Ladmin, Hamptonin, xAdmin, stuff like that, they have commands like /playerinfo, they are just named differently.

You can find them in the filterscript part of the forum.


Re: /playerinfo - saiberfun - 17.10.2009

pawn Код:
if (strcmp("/pinfo", cmdtext, true, 10) == 0)
    {
        new strs[256],IP[20];
        GetPlayerIP(playerid,IP,sizeof(IP));
        format(strs,sizeof(strs),"Money: %d Health: %f Armour: %f IP: %s",GetPlayerMoney(playerid),GetPlayerHealth(playerid),GetPlayerArmour(playerid),IP);
         return 1;
    }
without strtok
and with strtok:

pawn Код:
if(strcmp(cmd, "/pinfo", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) //If nothing is typed in behind /pinfo
        {
            SendClientMessage(playerid, YOURCOLOR, "USAGE: /pInfo [playerid]");
            SendClientMessage(playerid, YOURCOLOR, "FUNCTION: View player's stats.");
            return 1;
        }
        new giveplayerid = ReturnUser(tmp);
        if(IsPlayerConnected(giveplayerid))//If the player is connected
        {
            new sstring[90];
            new ip[20];
            GetPlayerIp(giveplayerid, ip, sizeof ip);
            GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
            format(sstring, sizeof(sstring), "%s's IP: %s Money: %d Health: %f Armour: %f", giveplayername,ip,GetPlayerMoney(playerid),GetPlayerHealth(playerid),GetPlayerArmour(playerid));
            SendClientMessage(playerid,YOURCOLOR, sstring);
        }
        else //If he ain't connected
        {
            format(string, sizeof(string), "%d is not an active player.", giveplayerid);
            SendClientMessage(playerid, YOURCOLOR, string);
        }
        return 1;
    }



Re: /playerinfo - Correlli - 17.10.2009

Quote:
Originally Posted by ┤ŞąiBЄЯҒПŋ├
pawn Код:
if (strcmp("/pinfo", cmdtext, true, 10) == 0)
    {
        new strs[256],IP[20];
        GetPlayerIP(playerid,IP,sizeof(IP));
        format(strs,sizeof(strs),"Money: %d Health: %f Armour: %f IP: %s",GetPlayerMoney(playerid),GetPlayerHealth(playerid),GetPlayerArmour(playerid),IP);
         return 1;
    }
without strtok
http://forum.sa-mp.com/index.php?topic=78026.0


Re: /playerinfo - dice7 - 17.10.2009

GetPlayerHealth and GetPlayerArmour do not return the health and armour so you can't use them like that


Re: /playerinfo - saiberfun - 17.10.2009

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by ┤ŞąiBЄЯҒПŋ├
pawn Код:
if (strcmp("/pinfo", cmdtext, true, 10) == 0)
    {
        new strs[256],IP[20];
        GetPlayerIP(playerid,IP,sizeof(IP));
        format(strs,sizeof(strs),"Money: %d Health: %f Armour: %f IP: %s",GetPlayerMoney(playerid),GetPlayerHealth(playerid),GetPlayerArmour(playerid),IP);
         return 1;
    }
without strtok
http://forum.sa-mp.com/index.php?topic=78026.0
I know where doing it quickly so no time to count.

Quote:
Originally Posted by dice7
GetPlayerHealth and GetPlayerArmour do not return the health and armour so you can't use them like that
didn't know that thanks.


Re: /playerinfo - Jakku - 17.10.2009

Quote:
Originally Posted by ┤ŞąiBЄЯҒПŋ├
pawn Код:
if (strcmp("/pinfo", cmdtext, true, 10) == 0)
    {
        new strs[256],IP[20];
        GetPlayerIP(playerid,IP,sizeof(IP));
        format(strs,sizeof(strs),"Money: %d Health: %f Armour: %f IP: %s",GetPlayerMoney(playerid),GetPlayerHealth(playerid),GetPlayerArmour(playerid),IP);
         return 1;
    }
without strtok
and with strtok:

pawn Код:
if(strcmp(cmd, "/pinfo", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) //If nothing is typed in behind /pinfo
        {
            SendClientMessage(playerid, YOURCOLOR, "USAGE: /pInfo [playerid]");
            SendClientMessage(playerid, YOURCOLOR, "FUNCTION: View player's stats.");
            return 1;
        }
        new giveplayerid = ReturnUser(tmp);
        if(IsPlayerConnected(giveplayerid))//If the player is connected
        {
            new sstring[90];
            new ip[20];
            GetPlayerIp(giveplayerid, ip, sizeof ip);
            GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
            format(sstring, sizeof(sstring), "%s's IP: %s Money: %d Health: %f Armour: %f", giveplayername,ip,GetPlayerMoney(playerid),GetPlayerHealth(playerid),GetPlayerArmour(playerid));
            SendClientMessage(playerid,YOURCOLOR, sstring);
        }
        else //If he ain't connected
        {
            format(string, sizeof(string), "%d is not an active player.", giveplayerid);
            SendClientMessage(playerid, YOURCOLOR, string);
        }
        return 1;
    }
Your command shows the player stats who typed that command. Not the ID as that guy wanted. Giveplayerid maybe fix it


Re: /playerinfo - saiberfun - 17.10.2009

Quote:
Originally Posted by Jakku
Your command shows the player stats who typed that command. Not the ID as that guy wanted. Giveplayerid maybe fix it
oops ye like i said done it quickly

pawn Код:
if (strcmp("/pinfo", cmdtext, true, 10) == 0)
    {
        new strs[85],IP[20],Float:Hth,Float:Arm;
        GetPlayerIP(playerid,IP,sizeof(IP));
        Float:Hth = GetPlayerHealth(playerid);
        Float:Arm = GetPlayerArmour(playerid);
        format(strs,sizeof(strs),"Money: %d Health: %f Armour: %f IP: %s",GetPlayerMoney(playerid),Float:Hth,Float:Arm,IP);
        return 1;
    }
pawn Код:
if(strcmp(cmd, "/pinfo", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) //If nothing is typed in behind /pinfo
        {
            SendClientMessage(playerid, YOURCOLOR, "USAGE: /pInfo [playerid]");
            SendClientMessage(playerid, YOURCOLOR, "FUNCTION: View player's stats.");
            return 1;
        }
        new giveplayerid = ReturnUser(tmp);
        if(IsPlayerConnected(giveplayerid))//If the player is connected
        {
            new sstring[90];
            new ip[20];
            new Float:Hth,Float:Arm;
            GetPlayerIp(giveplayerid, ip, sizeof ip);
            GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
            Float:Hth = GetPlayerHealth(giveplayerid);
            Float:Arm = GetPlayerArmour(giveplayerid);
            format(sstring, sizeof(sstring), "%s's IP: %s Money: %d Health: %f Armour: %f", giveplayername,ip,GetPlayerMoney(giveplayerid),Float:Hth,Float:Arm);
            SendClientMessage(playerid,YOURCOLOR, sstring);
        }
        else //If he ain't connected
        {
            format(string, sizeof(string), "%d is not an active player.", giveplayerid);
            SendClientMessage(playerid, YOURCOLOR, string);
        }
        return 1;
    }

these should work i guess