Many warnings!
#1

I used commands and fixed the most errors, but there are still three warnings and 1 error:

Код:
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(65) : warning 203: symbol is never used: "Str"
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(65) : warning 204: symbol is assigned a value that is never used: "Sender"
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(65) : warning 204: symbol is assigned a value that is never used: "pName"
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(82) : error 076: syntax error in the expression, or invalid function call
D:\Program Files\Rockstar Games\GTA San Andreas\eigener SAMP\gamemodes\deathmatch.pwn(85) : warning 204: symbol is assigned a value that is never used: "Str"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Line with warnigs:

pawn Код:
new PID, pName[MAX_PLAYER_NAME], Sender[MAX_PLAYER_NAME], Str;
and

pawn Код:
new Str[64];

Now the error line:

pawn Код:
if(IsPlayerAdmin)
Reply
#2

Just send us the command we cant do anything with out it
Reply
#3

pawn Код:
CMD:kick(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new PID, pName[MAX_PLAYER_NAME], Sender[MAX_PLAYER_NAME], Str;    //warningline
        if(sscanf(params, "us[128]", PID, params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]");
        if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");

        Kick(PID);
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
    }
    return 1;
}
pawn Код:
CMD:teleport(playerid, params[])
{
     if(IsPlayerAdmin)   //errorline
     {
        new ID;
        new Str[64];    //warning
        if(sscanf(params, "u", ID)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /goto [playerid]");
        else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
        else
        {
            new Float:x, Float:y, Float:z;
            GetPlayerPos(playerid, x, y, z);
            SetPlayerPos(ID, x+1, y+1, z);
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
    }
    return 1;
}
The errors are in my first post!
Reply
#4

Try this.

pawn Код:
CMD:kick(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new PID,  
        if(sscanf(params, "us[128]", PID, params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]");
        if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");

        Kick(PID);
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
    }
    return 1;
}
pawn Код:
CMD:teleport(playerid, params[])
{
     if(IsPlayerAdmin))  
     {
        new ID;
        if(sscanf(params, "u", ID)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /goto [playerid]");
        else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
        else
        {
            new Float:x, Float:y, Float:z;
            GetPlayerPos(playerid, x, y, z);
            SetPlayerPos(ID, x+1, y+1, z);
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
    }
    return 1;
}
Reply
#5

Just a note, the code Harry_Sandhu posted won't fix your problem. Read my post for an elaborate explanation on your problem.

pawn Код:
CMD:teleport(playerid, params[])
{
    if(IsPlayerAdmin(playerid)) {
        new ID;
        if(sscanf(params, "u", ID)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /goto [playerid]");
        else if(IsPlayerConnected(ID) == 0) SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
        else
        {
            new Float:x, Float:y, Float:z;
            GetPlayerPos(playerid, x, y, z);
            SetPlayerPos(ID, x+1, y+1, z);
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
    }
    return 1;
}
The first problem was that you weren't using your 'Str' variable and you were trying to split 'params' in to 'params' which could have caused recursion.

If you want to re-add 'reason' to kick, tell me and I'll help you to figure out how you can actually use it, since you did nothing with the reason variable.

pawn Код:
CMD:kick(playerid, params[])
{
    if(IsPlayerAdmin(playerid)) {
        new PID;
        if(sscanf(params, "u", PID)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]");
       
        if(!IsPlayerConnected(PID))
            return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");

        Kick(PID);
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
    }
    return 1;
}
The second problem was that you need to properly place the function within the if statement.

What you did was:

pawn Код:
if(IsPlayerAdmin)
'IsPlayerAdmin' is a function which requires an extra two parenthesis (round brackets) to be after the function name, and it has the parameter of 'playerid' (who it's checking to see has admin). The correct way would be:

pawn Код:
if(IsPlayerAdmin(playerid))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)