help me with command
#1

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;
    }
Reply
#2

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 ^
Reply
#3

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.
Reply
#4

bump ...
Reply
#5

help please
Reply
#6

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

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

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)