why is this little command not working?
#3

#EDIT:
Believing that the phone number is a numeric value, and is NON-ZERO - this code should work.
pawn Code:
if (strcmp(cmd, "/phnumber", true) == 0)
{
    new string[40];
    new phnumber[20];
    if(PlayerInfo[targetid][pPnumber] == 0) format(phnumber, 20, None);
    else if(PlayerInfo[targetid][pPnumber] != 0) format(phnumber, "%i", PlayerInfo[targetid][pPnumber]);   
    format(string, sizeof(string), "Your phone number is %s",phnumber);
    SendClientMessage(playerid, COLOR_GREY,string);
    return 1;
}
The code is untested, yet it should work fine.
I have changed '%d' to '%s' while formatting the 'string' because, phnumber is a string and not a integer/numeric value.
Reply


Messages In This Thread
why is this little command not working? - by MayaEU - 15.06.2016, 17:45
Re: why is this little command not working? - by oMa37 - 15.06.2016, 17:48
Re: why is this little command not working? - by biker122 - 15.06.2016, 17:54
Re: why is this little command not working? - by Stinged - 15.06.2016, 18:09

Forum Jump:


Users browsing this thread: 2 Guest(s)