SA-MP Forums Archive
Dumb problem I think :P please help - 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: Dumb problem I think :P please help (/showthread.php?tid=161981)



Dumb problem I think :P please help - bartje01 - 21.07.2010

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


Re: Dumb problem I think :P please help - willsuckformoney - 21.07.2010

can u send teh errors?


Re: Dumb problem I think :P please help - bartje01 - 21.07.2010

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


Re: Dumb problem I think :P please help - MadeMan - 21.07.2010

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



Re: Dumb problem I think :P please help - bartje01 - 21.07.2010

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


Re: Dumb problem I think :P please help - [L3th4l] - 21.07.2010

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


Re: Dumb problem I think :P please help - bartje01 - 21.07.2010

I really want to have dcmd XD


Re: Dumb problem I think :P please help - [L3th4l] - 21.07.2010

well just change CMD: to dcmd_


Re: Dumb problem I think :P please help - bartje01 - 21.07.2010

Thanks it works


Re: Dumb problem I think :P please help - [L3th4l] - 21.07.2010

^.^ no problemo