SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 14/04/2012, 11:12 AM   #1
AlTy
Big Clucker
 
Join Date: Oct 2011
Posts: 56
Reputation: 5
Default Any idea REP++

Why this doesnt work?

pawn Code:
CMD:agivecash(playerid, params[])
{
    new id, money;
    if(PlayerInfo [playerid][pAdmin] < 1)return SendClientMessage(playerid, COLOR_WHITE, "You need to be a admin to use that command!");
    else if(sscanf(params, "ud", id, money))SendClientMessage(playerid, COLOR_WHITE, "Usage: /agivecash [id/name][cash]");
    else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_WHITE,"Error: Player is not connected!");
    else if (money > 100000)SendClientMessage(playerid,COLOR_WHITE,"Error: Max money to send: 100000");
    else {
        new To[128], From[128];
        format(To, sizeof(To), "Admin %s(%d) has sended you %s of cash!", GetName(playerid), playerid, money);
        SendClientMessage(id,COLOR_PINK, To);
        format(From, sizeof(From), "You have sended %s of admin money to %s(%d)!", money, GetName(id),id);
        SendClientMessage(id,COLOR_PINK, From);
        GivePlayerMoney(id, money);
    }
    return 1;
}

CMD:gc(playerid, params[])
{
    new id, money, mymoney;
    mymoney = GetPlayerMoney(playerid);
    if(sscanf(params, "uu", id, money))SendClientMessage(playerid, COLOR_WHITE, "Usage: /gc [id/name][cash]");
    else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_WHITE,"Error: Player is not connected!");
    else if (money > 100000)SendClientMessage(playerid,COLOR_WHITE,"Error: Max money to send: 100000");
    else if (mymoney < money)SendClientMessage(playerid,COLOR_WHITE,"Error: You dont have this mouch of money!");
    else {
        new To[128], From[128];
        format(To, sizeof(To), "%s(%d) has sended you %s of cash!", GetName(playerid), playerid, money);
        SendClientMessage(id,COLOR_PINK, To);
        format(From, sizeof(From), "You have sended %s of money to %s(%d)!", money, GetName(id),id);
        SendClientMessage(id,COLOR_PINK, From);
        GivePlayerMoney(id, money);
        GivePlayerMoney(playerid, mymoney-money);
    }
    return 1;
}

CMD:setscore(playerid, params[])
{
    new id, money;
    if(PlayerInfo [playerid][pAdmin] < 4)return SendClientMessage(playerid, COLOR_WHITE, "You need to be admin lvl 4 to use that command!");
    else if(sscanf(params, "uu", id, money))SendClientMessage(playerid, COLOR_WHITE, "Usage: /setscore [id/name][score]");
    else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_WHITE,"Error: Player is not connected!");
    else if (id==playerid)SendClientMessage(playerid,COLOR_WHITE,"Error: You cant use this command on yourself!");
    else {
        new To[128], From[128];
        format(To, sizeof(To), "Admin %s(%d) has set your score to: %s.", GetName(playerid), playerid, money);
        SendClientMessage(id,COLOR_PINK, To);
        format(From, sizeof(From), "You have set %s score to %s(%d)!", money, GetName(id),id);
        SendClientMessage(id,COLOR_PINK, From);
        SetPlayerScore(id, money);
    }
    return 1;
}

WHen i execute it, nothing happens
AlTy is offline   Reply With Quote
Old 14/04/2012, 11:40 AM   #2
Jochemd
High-roller
 
Jochemd's Avatar
 
Join Date: Jul 2009
Location: The Netherlands
Posts: 2,220
Reputation: 844
Default Re: Any idea REP++

#1: Money is an integer, so instead of %s use %d
#2: In CMD:gc and CMDetscore, you define money as a player in sscanf ("uu"). You should use "ud"

I also recommend you to make sure your formats are OK.
__________________
Jochemd is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I have no idea... Skylar Paul Help Archive 2 15/05/2011 05:41 PM
Tab idea. LuxurioN General 13 10/01/2011 10:35 PM
any idea TopAz07 Help Archive 1 21/12/2010 12:49 PM
Anyone have an idea ? ArTisT Help Archive 0 21/03/2010 12:29 PM


All times are GMT. The time now is 01:35 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.