SA-MP Forums Archive
help me with command - 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)
+--- Thread: help me with command (/showthread.php?tid=396299)



help me with command - Hugoca - 30.11.2012

I make my command givelp in strcmp but it didn't work.Every time when i use it i get message "USAGE: /givelp [LP]".This is the code:
pawn Код:
if(strcmp(cmd, "/givelp", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givelp [LP]");
                return 1;
            }
            new exp;
            exp = strval(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 4 || IsPlayerAdmin(playerid))
            {
                    for(new i = 0; i < MAX_PLAYERS; i++)
                    {
                        GetPlayerName(playerid, giveplayer, sizeof(giveplayer));
                        PlayerInfo[i][Exp] += exp;
                        format(string, sizeof(string), "%s give to all players %d LP", PlayerName(playerid), exp);
                        SendClientMessageToAll(COLOR_LIGHTBLUE, string);
                    }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "You didn't have admin rights!");
            }
        }
        return 1;
    }



Re: help me with command - XtremeR - 30.11.2012

pawn Код:
if(strcmp(cmd, "/givelp", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
       if (sscanf(params, "dis", targetid,number)) return SendClientMessage(playerid, red, "USAGE: /setspree [playerid] [spree]");
            new exp;
            exp = strval(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 4 || IsPlayerAdmin(playerid))
            {
                    for(new i = 0; i < MAX_PLAYERS; i++)
                    {
                        GetPlayerName(playerid, giveplayer, sizeof(giveplayer));
                        PlayerInfo[i][Exp] += exp;
                        format(string, sizeof(string), "%s give to all players %d LP", PlayerName(playerid), exp);
                        SendClientMessageToAll(COLOR_LIGHTBLUE, string);
                    }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "You didn't have admin rights!");
            }
        }
        return 1;
    }
you need SSCAF if you want this one to work ^


Re: help me with command - Hugoca - 30.11.2012

i get this error:
Код:
C:\Users\CreeperTool\Desktop\gangwars\GANGWARS\gamemodes\gangwars54.pwn(5128) : error 017: undefined symbol "params"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: help me with command - Hugoca - 30.11.2012

bump ...


Re: help me with command - Hugoca - 30.11.2012

help please


Re: help me with command - Mmartin - 30.11.2012

Instead of params variable use the variable where you're storing the params (tmp I guess?)


Re: help me with command - Hugoca - 30.11.2012

please give me the code i try to make it but .. no efect


Re: help me with command - Mmartin - 30.11.2012

Show us what did you try and we'll correct you.


Re: help me with command - Hugoca - 30.11.2012

I make the command to work but now he's spam the chat.Please help.Code:
pawn Код:
if(strcmp(cmd, "/givelp", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givelp [1000] [LP]");
                return 1;
            }
            new para1;
            new level;
            para1 = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
            level = strval(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 4 || IsPlayerAdmin(playerid))
            {
                    for(new i = 0; i < MAX_PLAYERS; i++)
                    {
                        PlayerInfo[i][Exp] += level;
                        format(string, sizeof(string), "%s даде на всички играчи %d LP", PlayerName(playerid), level);
                        SendClientMessageToAll(COLOR_LIGHTBLUE, string);
                    }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "Нямаш достатъчно админ права!");
            }
        }
        return 1;
    }