SA-MP Forums Archive
Command Does nothing? - 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: Command Does nothing? (/showthread.php?tid=398861)



Command Does nothing? - Lz - 11.12.2012

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.



Re: Command Does nothing? - ReVo_ - 11.12.2012

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

[pLSPD] => Array? where is the name

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

5(playerid) => 5(playerid) ??


Re: Command Does nothing? - InfiniTy. - 11.12.2012

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..


Re: Command Does nothing? - Lz - 11.12.2012

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


Re: Command Does nothing? - ReVo_ - 11.12.2012

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?


Re: Command Does nothing? - NoahF - 11.12.2012

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))



Re: Command Does nothing? - Lz - 13.12.2012

i still get nothing


Re: Command Does nothing? - Roel - 13.12.2012

Where did you put this command?


Re: Command Does nothing? - Lz - 13.12.2012

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


Re: Command Does nothing? - Roel - 13.12.2012

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...