help pls
#1

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
Reply
#2

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;
}
Reply
#3

nvm nvm thanks
Reply
#4

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

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

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.
Reply
#7

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.
Reply
#8

sorry tee, i was on iphone then i forgot xD
Reply
#9

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.
Reply
#10

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 ^^.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)