Command Does nothing?
#1

pawn Код:
COMMAND:invitesapd(playerid, params[])
{
    if(PlayerInfo[pLSPD] != 5))
    {
        new toplayerid, // the player we want to make SA-PD
            rank; // extracting player's ID and rank from params
        if (!sscanf(params, "ui", toplayerid, rank))
        {
          if (toplayerid = INVALID_PLAYER_ID)
          {
            PlayerInfo[pLSPD][toplayerid] = rank;
            new
            message[40];
            format(message, sizeof(message), "You were set rank %i By the SA-PD Leader.!", rank);
            SendClientMessage(toplayerid, 0x00FF00FF, message);
          }
          else SendClientMessage(playerid, 0xFF0000FF, "That player is not connected");
        }
        else SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /finvite <playerid> <rank>");
    }
    else SendClientMessage(playerid, 0xFF0000FF, "Only the SA-PD Leader can use this command!");
    return 1;
}
Edit - updated the command today and still i get nothing, not even command unknown or anything like that :S

Edit 2 - Re did the command but changed it a little and still i get no response in server :S

pawn Код:
CMD:invitelspd(playerid, params[])
{
     if(PlayerInfo[pLSPD] != 5))
     new toplayerid,
         rank;
     if (sscanf(params, "ui", toplayerid, rank)) return SendClientMessage(playerid, 0xFF0000AA, "[SERVER] Usage: /invitelspd <playerid> <rank>");
     else if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "[SERVER] Invalid ID");
     else if (toplayerid == playerid) SendClientMessage(playerid, 0xFF0000AA, "[SERVER] You can't invite yourself!");
     PlayerInfo[pLSPD][toplayerid] = rank;
     new message[128]
     format(string, sizeof string, "[SERVER] You were set rank %i by the SA-PD leader", rank,);
     SendClientMessage(giveplayerid, COL_WHITE, message);
     return 1;
     }
For both commands i always get this warning though..

pawn Код:
C:\Users\Scripting.Ash-PC\Desktop\Scripting\Roleplaying Server\gamemodes\roleplay.pwn(391) : warning 203: symbol is never used: "invitelspd"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
Reply
#2

Some syntax errors here.. if ([pLSPD] =<5(playerid))

[pLSPD] => Array? where is the name

[pLSPD] += strval (params); => same top

5(playerid) => 5(playerid) ??
Reply
#3

I'm surprised it didn't give you any error.. anyway

pawn Код:
COMMAND:finvitelspd(playerid, params[])
{
    if(pLSPD[playerid] >= 5)
    {
        new toplayerid, // the player we want to make SA-PD
            rank; // extracting player's ID and rank from params
        if (!sscanf(params, "ui", toplayerid, rank))
        {
          if (toplayerid != INVALID_PLAYER_ID)
          {
            pLSPD[toplayerid] = rank;
            new
            message[40];
            format(message, sizeof(message), "You were set rank %i By the SA-PD Leader.!", rank);
            SendClientMessage(toplayerid, 0x00FF00FF, message);
          }
          else SendClientMessage(playerid, 0xFF0000FF, "That player is not connected");
        }
        else SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /finvite <playerid> <rank>");
    }
    else SendClientMessage(playerid, 0xFF0000FF, "Only the SA-PD Leader can use this command!");
    return 1;
}
Assuming that plspd is for players not just an array..
Reply
#4

Quote:
Originally Posted by Adytza.
Посмотреть сообщение
I'm surprised it didn't give you any error.. anyway

pawn Код:
COMMAND:finvitelspd(playerid, params[])
{
    if(pLSPD[playerid] >= 5)
    {
        new toplayerid, // the player we want to make SA-PD
            rank; // extracting player's ID and rank from params
        if (!sscanf(params, "ui", toplayerid, rank))
        {
          if (toplayerid != INVALID_PLAYER_ID)
          {
            pLSPD[toplayerid] = rank;
            new
            message[40];
            format(message, sizeof(message), "You were set rank %i By the SA-PD Leader.!", rank);
            SendClientMessage(toplayerid, 0x00FF00FF, message);
          }
          else SendClientMessage(playerid, 0xFF0000FF, "That player is not connected");
        }
        else SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /finvite <playerid> <rank>");
    }
    else SendClientMessage(playerid, 0xFF0000FF, "Only the SA-PD Leader can use this command!");
    return 1;
}
Assuming that plspd is for players not just an array..
I edited that to...

pawn Код:
COMMAND:finvitelspd(playerid, params[])
{
    if(PlayerInfo[pLSPD][playerid] >= 5)
    {
        new toplayerid, // the player we want to make SA-PD
            rank; // extracting player's ID and rank from params
        if (!sscanf(params, "ui", toplayerid, rank))
        {
          if (toplayerid != INVALID_PLAYER_ID)
          {
            PlayerInfo[pLSPD][toplayerid] = rank;
            new
            message[40];
            format(message, sizeof(message), "You were set rank %i By the SA-PD Leader.!", rank);
            SendClientMessage(toplayerid, 0x00FF00FF, message);
          }
          else SendClientMessage(playerid, 0xFF0000FF, "That player is not connected");
        }
        else SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /finvite <playerid> <rank>");
    }
    else SendClientMessage(playerid, 0xFF0000FF, "Only the SA-PD Leader can use this command!");
    return 1;
}
Because of the Array name ( i think ) But still i get no response from the command
Reply
#5

use debug to know where the code stops..

if you do /finvitelspd when you are not lspd code works?
When you do /finvitelspd w/o args code works good?

When you type /finvitelspd <id> code fails?
Reply
#6

Why did you put a "!" in the SScanF? Try removing it and seeing if it works.
Don't forget an Else statement BTW. :P

Код:
if (sscanf(params, "ui", toplayerid, rank))
Reply
#7

i still get nothing
Reply
#8

Where did you put this command?
Reply
#9

Quote:
Originally Posted by Roel
Посмотреть сообщение
Where did you put this command?
Its ZCMD so i thought i can put it anywhere in the main script?
But i put it below my OnPlayerCommandText function
Reply
#10

We as long you don't put it inside onplayercommandtext then it's fine.
Then I don't see why you are getting this warning...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)