if player does not write any id..
#6

isnull is used for strings/arrays whatever. If you want to use isnull, you should do isnull(params)

Try doing it the way I suggested you do, as I think you will learn something more useful this way (optional specifiers in sscanf).
Also, does iString really need to have a size of 2000? Lol, cut it down a bit. You can't send a message longer than 144 characters (I think. It might be 128 or 140 something, unless you're using some other code to split the message but in your case you really don't need to split anything as everything should fit perfectly). So just make it that size.

PHP код:
CMD:stats(playeridparams[])
{
    new 
id;
    if(
connected[playerid] == true) return GameTextForPlayer(playerid"~r~Spawn First"50005);
    if(
sscanf(params"U(-1)"id)) return SendClientMessage(playerid, -1"{c3c3c3}(INFO) /stats [id]");
    if( 
id == -)
    {
         new 
iString[140];
         
format (iStringsizeof(iString), "{ffff99}(INFO) Current session stats of: %s"PlayerName[playerid]);
         
SendClientMessage(playerid, -1iString);
         
format(iString,sizeof(iString),"{ffff99}Score: %i ~ Level: %i ~ Duels Win: %i ~ Duels Lost: %i"pInfo[playerid][Score], pInfo[playerid][Level], pInfo[playerid][DuelsWin], pInfo[playerid][DuelsLost]);
         
SendClientMessage(playerid, -1iString);
         
format(iString,sizeof(iString),"{ffff99}Points: %i ~ Respect: %i ~ Kills: %i ~ Deaths: %i ~ Ratio: %.2f"pInfo[playerid][Points], pInfo[playerid][Respect], pInfo[playerid][Kills], pInfo[playerid][Deaths], floatdiv(pInfo[playerid][Kills], pInfo[playerid][Deaths]));
         
SendClientMessage(playerid, -1iString);
          
format(iString,sizeof(iString),"{ffff99}Session Kills: %i ~ Session Deaths: %i ~ Session Ratio: %.2f"PlayerKills[playerid], PlayerDeaths[playerid], floatdiv(PlayerKills[playerid], PlayerDeaths[playerid]), pInfo[playerid][Headshots]);
         
SendClientMessage(playerid, -1iString);
          
format(iString,sizeof(iString),"{ffff99}Headshots given: %i/45"pInfo[playerid][Headshots]);
         
SendClientMessage(playerid, -1iString);
    }
    else if(
id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1"{c3c3c3}(INFO) That player is not connected!");
    else
    {
         new 
iString[140];
         
format (iStringsizeof(iString), "{ffff99}(INFO) Current session stats of: %s"PlayerName[id]);
         
SendClientMessage(playerid, -1iString);
         
format(iString,sizeof(iString),"{ffff99}Score: %i ~ Level: %i ~ Duels Win: %i ~ Duels Lost: %i"pInfo[id][Score], pInfo[id][Level], pInfo[id][DuelsWin], pInfo[id][DuelsLost]);
         
SendClientMessage(playerid, -1iString);
         
format(iString,sizeof(iString),"{ffff99}Points: %i ~ Respect: %i ~ Kills: %i ~ Deaths: %i ~ Ratio: %.2f"pInfo[id][Points], pInfo[id][Respect], pInfo[id][Kills], pInfo[id][Deaths], floatdiv(pInfo[id][Kills], pInfo[id][Deaths]));
         
SendClientMessage(playerid, -1iString);
          
format(iString,sizeof(iString),"{ffff99}Session Kills: %i ~ Session Deaths: %i ~ Session Ratio: %.2f"PlayerKills[id], PlayerDeaths[id], floatdiv(PlayerKills[id], PlayerDeaths[id]), pInfo[id][Headshots]);
         
SendClientMessage(playerid, -1iString);
          
format(iString,sizeof(iString),"{ffff99}Headshots given: %i/45"pInfo[id][Headshots]);
         
SendClientMessage(playerid, -1iString);
    }
     return 
1;

Reply


Messages In This Thread
if player does not write any id.. - by ivndosos - 01.03.2018, 12:24
Re: if player does not write any id.. - by AdamsLT - 01.03.2018, 13:27
Re: if player does not write any id.. - by GRiMMREAPER - 01.03.2018, 13:40
Re: if player does not write any id.. - by jasperschellekens - 01.03.2018, 13:46
Re: if player does not write any id.. - by ivndosos - 01.03.2018, 15:45
Re: if player does not write any id.. - by AdamsLT - 01.03.2018, 15:51
Re: if player does not write any id.. - by Dayrion - 01.03.2018, 16:34
Re: if player does not write any id.. - by ivndosos - 01.03.2018, 16:53
Re: if player does not write any id.. - by AroseKhanNiazi - 01.03.2018, 22:01
Re: if player does not write any id.. - by ivndosos - 02.03.2018, 06:25

Forum Jump:


Users browsing this thread: 1 Guest(s)