/playerinfo
#1

Hello,

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

- money
- Player IP
- Health + Armour

please help me
Reply
#2

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

I have search, but I don't find it..
Reply
#4

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.
Reply
#5

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;
    }
Reply
#6

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
Reply
#7

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

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.
Reply
#9

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
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)