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



CMD help - wilko1995 - 14.01.2011

pawn Код:
dcmd_getinfo(playerid, params[])
{
    if(PInfo[playerid][Level] >= 1)
    {
        new str[256], pid, pveh, pping, pcash, Float:phealth, Float:parmour, plevel;
        if(!strval(params)) return SendClientMessage(playerid, RED, "USAGE: /getinfo <playerid>");
        pid = strval(params);
        if(IsPlayerConnected(pid) && pid != INVALID_PLAYER_ID)
        {
            pveh = GetPlayerVehicleID(pid);
            pping = GetPlayerPing(pid);
            pcash = GetPlayerMoney(pid);
            GetPlayerHealth(pid, phealth);
            GetPlayerArmour(pid, parmour);
            plevel = PInfo[pid][Level];
            format(str, sizeof(str), "Player ID: %d \n\n Vehicle ID: %d \n\n Player Ping: %d \n\n Player Cash: %d \n\n Player Health: %d \n\n Player Armour: %d, Player Level: %d", pid, pveh, pping, pcash, phealth, parmour, plevel);
            SendClientMessage(playerid, YELLOW, str);
            return 1;
        }
        else return SendClientMessage(playerid, RED, "USAGE: /getinfo <playerid>");
    }
    else return 0;
}
When i type "/getinfo 1" it shows me the info of playerid 1 if (s)he is connected. But if i type "/getinfo 0" When (s)he is connected it comes back saying "USAGE: /getinfo <playerid>"

Please help


Re: CMD help - ғαιιοцт - 14.01.2011

Use if(!strlen(params))
Instead of if(!strval(params))

because when params equals "0"
then the strval of params will be 0, and the if structure would be true


Re: CMD help - wilko1995 - 14.01.2011

oh. =D Thanks