[help]givemoney
#1

i made a givemoney command... i want to do that you have to choose an account that is connected to the server...
i know that i need to use IsPlayerConnected but i dont know where... plz help
sorry for my bad english
Reply
#2

SSCANF + ZCMD:

pawn Код:
CMD:givemoney(playerid, params[])
{
    new giveplayerid, cash;
    if(sscanf(params, "ud", giveplayerid, cash))
        return SendClientMessage(playerid, 0xAAAAAA, "Usage: /givemoney [playerid] [money]");
    if(!IsPlayerConnected(giveplayerid)) // here
        return SendClientMessage(playerid, 0xAAAAAA, "Player not connected");
    if(giveplayerid == playerid)
        return SendClientMessage(playerid, 0xAAAAAA, "You cannot give money to yourself");
    // Now the givecash code...
    return 1;
}
Reply
#3

Full code will look like this.
I took this code from previous post.
Also be sure that you have 'ZCMD' include and sscanf include.
It is possible to define sscanf with native:
pawn Код:
native sscanf(const data[], const format[], {Float,_}:...);
pawn Код:
CMD:givemoney(playerid, params[])
{
    new
        giveplayerid,
        cash
    ;
    if(sscanf(params, "ud", giveplayerid, cash))
        return SendClientMessage(playerid, 0xAAAAAA, "Usage: /givemoney [playerid] [money]");
    if(!IsPlayerConnected(giveplayerid)) // here
        return SendClientMessage(playerid, 0xAAAAAA, "Player not connected");
    if(giveplayerid == playerid)
        return SendClientMessage(playerid, 0xAAAAAA, "You cannot give money to yourself");
       
    GivePlayerMoney(giveplayerid, cash);
    return 1;
}
Reply
#4

Quote:
Originally Posted by FreshDoubleX
Посмотреть сообщение
It is possible to define sscanf with native:
pawn Код:
native sscanf(const data[], const format[], {Float,_}:...);
Yes but that won't work without a plugin
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)