SA-MP Forums Archive
[help]givemoney - 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: [help]givemoney (/showthread.php?tid=218126)



[help]givemoney - omer5198 - 29.01.2011

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


Re: [help]givemoney - Mean - 29.01.2011

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;
}



Re: [help]givemoney - FreshDoubleX - 29.01.2011

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;
}



Re: [help]givemoney - Mean - 29.01.2011

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