So weird..
#1

I just cannot understand how this is wrong...
What's wrong about this code?

PHP код:
CMD:getcash(playeridparams[])
{
    if(
PlayerInfo[playerid][AdminLevel] < 1) return 0;
       if(
PlayerInfo[playerid][AdminLevel] < 2) return SendClientMessage(playeridCOLOR_YELLOWGREEN"Error: You are not authorized to use this command.");
    new 
targetplayer;
    if(
sscanf(params"i"targetplayer)) return SendClientMessage(playeridCOLOR_ORANGE"Usage: /getcash [ID]");
    if(!
IsPlayerConnected(targetplayer)) return SendClientMessage(playeridCOLOR_RED"Error: Player is not connected!");
    new 
string[50], pName[MAX_PLAYER_NAME], amount;
    
GetPlayerName(targetplayerpNameMAX_PLAYER_NAME);
    
format(stringsizeof string"%s is currently holding $%i."pNameamount);
    
GetPlayerMoney(targetplayer);
    
SendClientMessage(playeridCOLOR_YELLOWstring);
    return 
1;

It says me always that the player has $0 even when the player has like 10k or smth.
Reply
#2

PHP код:
CMD:getcash(playeridparams[])
{
    if(
PlayerInfo[playerid][AdminLevel] < 1) return 0;
       if(
PlayerInfo[playerid][AdminLevel] < 2) return SendClientMessage(playeridCOLOR_YELLOWGREEN"Error: You are not authorized to use this command.");
    new 
targetplayer;
    if(
sscanf(params"i"targetplayer)) return SendClientMessage(playeridCOLOR_ORANGE"Usage: /getcash [ID]");
    if(!
IsPlayerConnected(targetplayer)) return SendClientMessage(playeridCOLOR_RED"Error: Player is not connected!");
    new 
string[50], pName[MAX_PLAYER_NAME], amount;
    
GetPlayerName(targetplayerpNameMAX_PLAYER_NAME);
    
amount GetPlayerMoney(targetplayer);
    
format(stringsizeof string"%s is currently holding $%i."pNameamount);
    
SendClientMessage(playeridCOLOR_YELLOWstring);
    return 
1;

Reply
#3

Same story...

EDIT: Fixed.
Reply
#4

Excuse me, but i just tested it on my server, it worked prefectly :/, Are you sure?
This simple does the job as i posted above:
PHP код:
    amount GetPlayerMoney(targetplayer); // storing player money in amount.
    
format(stringsizeof string"%s is currently holding $%i."pNameamount); // formating the text with amount.
    
SendClientMessage(playeridCOLOR_YELLOWstring); //sends the message :/ 
Reply
#5

View my previous post. Thank you btw.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)