Setcash
#1

When I Compile my admin fs i got these errors:
Код:
E:\Freeroam World\filterscripts\admin.pwn(650) : error 017: undefined symbol "IsNumeric"
E:\Freeroam World\filterscripts\admin.pwn(650) : error 036: empty statement
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
These Errors Come From This Command:
pawn Код:
dcmd_setcash(playerid,params[])
{
        new Index;
        new tmp[256];  tmp  = strtok(params,Index);
        new tmp2[256]; tmp2 = strtok(params,Index);
        new id,n[MAX_PLAYER_NAME];
        new Money = strval(tmp2);
        new str[50];
        if(!strlen(tmp) || !strlen(tmp2) || !IsNumeric(tmp2));
        if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid,ORANGE,"You need to be level 3 to use this command!");
        if(!strlen(params)) return SendClientMessage(playerid,GREY,"USAGE: /Setcash <ID> <Amount> ");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid,GREY,"Invalid ID");
        ResetPlayerMoney(id);
        GivePlayerMoney(id, Money);
        format(str,sizeof(str),"Admin: %s has set your cash to $%d",n, Money);
        SendClientMessage(id,GREEN,str);
        return 1;
}
Reply
#2

Add this anywhere in your Game mode!
pawn Код:
IsNumeric(const string[])
{
    for (new i = 0, j = strlen(string); i < j; i++) {
        if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
}
Reply
#3

pawn Код:
// At The Bottom
IsNumeric(const string[])
{
    for (new i = 0, j = strlen(string); i < j; i++)
    {
        if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
}
Also about the empty statement
pawn Код:
if(!strlen(tmp) || !strlen(tmp2) || !IsNumeric(tmp2)) return 1;
Reply
#4

Most Probably copied from the LuxAdmin ^^

Well don't take it as an offense, just kidding.

I recommend you to use sscanf and Zcmd and ZCMD is the most fastest command processor in SAMP and sscanf is better and more efficient then other things.

pawn Код:
dcmd_setcash(playerid, params[])
{
    new pID, cash;
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "ud", pID, cash)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setcash [playerid] [amount of money]");
        if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
        ResetPlayerMoney(pID);
        GivePlayerMoney(pID,cash);
    }
    else
    {
            SendClientMessage(playerid, COLOR_RED, "You must be administrator to use that command!");
     }
}
Made a rough one, test if this works, made fast from phone.

-FalconX
Reply
#5

Quote:
Originally Posted by ue_falconx
Посмотреть сообщение
Most Probably copied from the LuxAdmin ^^

Well don't take it as an offense, just kidding.

I recommend you to use sscanf and Zcmd and ZCMD is the most fastest command processor in SAMP and sscanf is better and more efficient then other things.

pawn Код:
dcmd_setcash(playerid, params[])
{
    new pID, cash;
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "ud", pID, cash)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setcash [playerid] [amount of money]");
        if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
        ResetPlayerMoney(pID);
        GivePlayerMoney(pID,cash);
    }
    else
    {
            SendClientMessage(playerid, COLOR_RED, "You must be administrator to use that command!");
     }
}
Made a rough one, test if this works, made fast from phone.

-FalconX
I Wasn't Know How To Use This tmp2 and i copied it......
but any way the sscanf is really easy i learned it now by this cmd
and it's working fine thnx i am going to convert the all cmds to sccanf
Reply
#6

Quote:
Originally Posted by misho1
Посмотреть сообщение
I Wasn't Know How To Use This tmp2 and i copied it......
but any way the sscanf is really easy i learned it now by this cmd
and it's working fine thnx i am going to convert the all cmds to sccanf
Its ok mate i was just joking, i am happy that i have helped you.

-FalconX
Reply
#7

i need help in another thing
pawn Код:
if(gun < 47) return SendClientMessage(playerid,GREY,"Wrong Weapon ID You Can Get The Weapons IDS From Samp Wiki");
it doesn't say some thing
Reply
#8

sry for double post
i want to know how to make in givegun cmd that when some one wrote wrong id it say that he/she added wrong id
Reply
#9

You already added it, if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
Reply
#10

pawn Код:
if(gun < 1 || gun > 47) return SendClientMessage(playerid,GREY,"Wrong Weapon ID You Can Get The Weapons IDS From Samp Wiki");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)