Dumb problem I think :P please help
#1

Hey guys. I just made a setcash command with dcmd>
What is wrong?:P
It always set the money to 0 :P

pawn Код:
dcmd_setcash(playerid,params[])
{
new string[286];
new target;
target = strval(params);
new amount;
if(adminlevel[playerid]<2)
{
SendClientMessage(playerid,COLOR_GREY,"You're not allowed to use this command");
return 1;
}
if(sscanf(params,"ud",playerid,amount))
{
SendClientMessage(playerid,COLOR_RED,"*Wrong format*");
SendClientMessage(playerid,COLOR_GREY,"HINT: Type /setcash [playerid] [amount]");
return 1;
}

SetPlayerMoney(target,amount);
format(string,sizeof(string),"*You've set %s's money to $%d*",playername[target],amount);
SendClientMessage(playerid,COLOR_RED,string);
format(string,sizeof(string),"*Your money has been set to $%d by admin %s*",amount,playername[playerid]);
SendClientMessage(target,COLOR_RED,string);
return 1;
}
Probaly a dumb mistake? :P
Thankya
Reply
#2

can u send teh errors?
Reply
#3

There are no errors. The command just set my money to 0 in all cases.
Reply
#4

pawn Код:
dcmd_setcash(playerid,params[])
{
    new string[128];
    new target, amount;
    if(adminlevel[playerid]<2)
    {
        SendClientMessage(playerid,COLOR_GREY,"You're not allowed to use this command");
        return 1;
    }
    if(sscanf(params,"ud",target,amount))
    {
        SendClientMessage(playerid,COLOR_RED,"*Wrong format*");
        SendClientMessage(playerid,COLOR_GREY,"HINT: Type /setcash [playerid] [amount]");
        return 1;
    }
    SetPlayerMoney(target,amount);
    format(string,sizeof(string),"*You've set %s's money to $%d*",playername[target],amount);
    SendClientMessage(playerid,COLOR_RED,string);
    format(string,sizeof(string),"*Your money has been set to $%d by admin %s*",amount,playername[playerid]);
    SendClientMessage(target,COLOR_RED,string);
    return 1;
}
Reply
#5

Doesn't work eiter.
When I only type /setcash 0 it already says your cash has been setted to 0.
And when I do /setcash 0 10 it also sets to 0. dammit
Reply
#6

pawn Код:
CMD:setcash(playerid,params[])
{
    new ID,Ammount;
    if(sscanf(params,"dd",ID,Ammount)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /SetCash ( playerid ) ( Ammount )");
    if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,COLOR_RED,"That User Is Offline");
    GivePlayerMoney(ID,Ammount);
    return SendClientMessage(playerid,COLOR_GREEN,"Money Successfully Transferred.");
}
modify to format player names if you want that
Reply
#7

I really want to have dcmd XD
Reply
#8

well just change CMD: to dcmd_
Reply
#9

Thanks it works
Reply
#10

^.^ no problemo
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)