SA-MP Forums Archive
help pls - 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 pls (/showthread.php?tid=233567)



help pls - tanush - 01.03.2011

can you guys help me how to make someone banned with reason! for example
Admin tanush has banned George_bush for "pwnt".
im using sscanf + zcmd

and another question, how i make a limit for people cash like for example when i buy something at bar for $20 while i have 0, my money goes -20


Re: help pls - Antonio [G-RP] - 01.03.2011

pawn Код:
CMD:ban(playerid, params[])
{
    new id, reason[64];
    if(sscanf(params, "us[64]", id, reason)) return SendClientMessage(playerid, -1, "USAGE: /ban [id] [reason]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "That player isn't connected!");
    if(IsPlayerAdmin(playerid))
    {
        new name[MAX_PLAYER_NAME];
        GetPlayerName(id, name, sizeof(name));
        new string[128];
        format(string, sizeof(string), "%s was banned for %s", name, reason);
        SendClientMessageToAll(-1, string);
        Ban(id);
    }
    else {
        SendClientMessage(playerid, -1, "You aren't admin!");
    }
    return 1;
}



Re: help pls - tanush - 02.03.2011

nvm nvm thanks


Re: help pls - mprofitt - 02.03.2011

Nice job Antonio....but can you do it using only 1 hand?


Re: help pls - tanush - 02.03.2011

and second question, why can people buy things while they have $0!?!?!??!


Re: help pls - Tee - 02.03.2011

Tanush i thought i told you.

pawn Код:
if(GetPlayerMoney(playerid) < WHAT EVER HERE))return SendClientMessage(playerid,COLOR,"You need whatever to buy thhis");
Example :

pawn Код:
CMD:ban(playerid, params[])
{
    new id, reason[64];
    if(GetPlayerMoney(playerid) < 200))return SendClientMessage(playerid,COLOR,"You need $200 to use this command");
    if(sscanf(params, "us[64", id, reason)) return SendClientMessage(playerid, -1, "USAGE: /ban [id] [reason]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "That player isn't connected!");
    if(IsPlayerAdmin(playerid))
    {
        new name[MAX_PLAYER_NAME];
        GetPlayerName(id, name, sizeof(name));
        new string[128];
        format(string, sizeof(string), "%s was banned for %s", name, reason);
        SendClientMessageToAll(-1, string);
        Ban(id);
    }
    else {
        SendClientMessage(playerid, -1, "You aren't admin!");
    }
    return 1;
}
I added it to the Ban command.

Explanation:

if - It makes a decission. Like if(IsThePlayer'sMone*****Than 200?) <--That is not a function in pawn just an example
GetPlayerMoney(playerid) - Gets the players holding cash.
< - That sign means less than. So if(IsThePlayer'sMoney < 200?)

I don't know if you understand.

Also this link may help you.
Tan also in sscanf never use "i" for playerid always use "u". What "u" does is if you type /ban tan. It will ban "tan" but if you use "i" and type /ban tan it will return Unknown Command. The "u" looks for the player that you type or the 1st letter in the players name and execute the command.


Re: help pls - Antonio [G-RP] - 02.03.2011

Quote:
Originally Posted by mprofitt
Посмотреть сообщение
Nice job Antonio....but can you do it using only 1 hand?
I can do it with one finger off of that one hand.


Re: help pls - tanush - 02.03.2011

sorry tee, i was on iphone then i forgot xD


Re: help pls - Antonio [G-RP] - 02.03.2011

Quote:
Originally Posted by tanush
Посмотреть сообщение
sorry tee, i was on iphone then i forgot xD
What Tee told you, is a client side money check. With that, players could hack money. I suggest you search for a 'Server Side Money' topic, that will help you get going on that.


Re: help pls - Mean - 02.03.2011

Quote:
Originally Posted by tanush
Посмотреть сообщение
and second question, why can people buy things while they have $0!?!?!??!
pawn Код:
if( GetPlayerMoney( playerid ) < 2000 ) return SendClientMessage( playerid, 0xAAAAAA, "You need $2000 to buy this" );
Example ^^.