CMD problem?
#1

Error

Код:
../gamemodes/OnPlayerCommandZCMD.pwn(3485) : warning 209: function "cmd_givegunlicense" should return a value
../gamemodes/OnPlayerCommandZCMD.pwn(3486) : error 010: invalid function or declaration
../gamemodes/OnPlayerCommandZCMD.pwn(3491) : error 010: invalid function or declaration
../gamemodes/OnPlayerCommandZCMD.pwn(3698) : error 029: invalid expression, assumed zero
cmd
pawn Код:
}
CMD:givegunlicense(playerid, params[])
{
    new targetid;
    if(sscanf(params, "us[128]", targetid)) SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /giveweaponlicense [playerid/partofname]");
    if (playerid == targetid) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot blind yourself.");
    if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "SERVER: This player is not connected.");
    if (PlayerCuffed[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot do while cuffed");
    if (PlayerTazed[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot do while tazed");
    if (PlayerTied[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot do while tied");
    if (Died[playerid] == 1) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Cannot use this command while dead.");
    if(PlayerInfo[playerid][pFaction] == 1 && PlayerInfo[playerid][pRank] <= 2 || PlayerInfo[playerid][pAdministrator] > 0)
    {
            new Float:NearYou[3];
            GetPlayerPos(giveplayerid, NearYou[0], NearYou[1], NearYou[2]);
            if(!IsPlayerInRangeOfPoint(playerid, 1.0, NearYou[0], NearYou[1], NearYou[2])) //1.0 is the range, try changing it if you don't like 1.0
            {
                SendClientMessage(playerid,-1,"You must be near the player!");
                return 1;
            }
            if(giveplayerid != INVALID_PLAYER_ID)
            {
                   new wep1[128];
                   PlayerInfo[giveplayerid][pWepLic] = 1;
                   format(wep1, sizeof(wep1), "gives %s a weapon license.",GetPlayerNameEx(giveplayerid));
                   PlayerActionMessage(playerid,15.0,wep1);
                   new give1[128];
                   format(give1, sizeof(give1), "You have given %s a weapon license.", GetPlayerNameEx(giveplayerid));
                   SendClientMessage(playerid, COLOR_WHITE, give1);
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
        }
    }
    return 1;
Reply
#2

pawn Код:
}
CMD:givegunlicense(playerid, params[])
{
    new targetid;
    if(sscanf(params, "us[128]", targetid)) SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /giveweaponlicense [playerid/partofname]");
    if (playerid == targetid) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot blind yourself.");
    if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "SERVER: This player is not connected.");
    if (PlayerCuffed[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot do while cuffed");
    if (PlayerTazed[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot do while tazed");
    if (PlayerTied[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot do while tied");
    if (Died[playerid] == 1) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Cannot use this command while dead.");
    if(PlayerInfo[playerid][pFaction] == 1 && PlayerInfo[playerid][pRank] <= 2 || PlayerInfo[playerid][pAdministrator] > 0)
    {
            new Float:NearYou[3];
            GetPlayerPos(giveplayerid, NearYou[0], NearYou[1], NearYou[2]);
            if(!IsPlayerInRangeOfPoint(playerid, 1.0, NearYou[0], NearYou[1], NearYou[2])) //1.0 is the range, try changing it if you don't like 1.0
            {
                SendClientMessage(playerid,-1,"You must be near the player!");
                return 1;
            }
            if(giveplayerid != INVALID_PLAYER_ID)
            {
                   new wep1[128];
                   PlayerInfo[giveplayerid][pWepLic] = 1;
                   format(wep1, sizeof(wep1), "gives %s a weapon license.",GetPlayerNameEx(giveplayerid));
                   PlayerActionMessage(playerid,15.0,wep1);
                   new give1[128];
                   format(give1, sizeof(give1), "You have given %s a weapon license.", GetPlayerNameEx(giveplayerid));
                   SendClientMessage(playerid, COLOR_WHITE, give1);
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
        }
    }
    return 1;
}
msising bracket
Reply
#3

You seriously need to learn how to indent your code. Well anyway, I checked your script and saw there was a useless bracket, well give it a try, I hope it helps

pawn Код:
CMD:givegunlicense(playerid, params[])
{
    new targetid;
    if(sscanf(params, "us[128]", targetid)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /giveweaponlicense [playerid/partofname]");
    if (playerid == targetid) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot blind yourself.");
    if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "SERVER: This player is not connected.");
    if (PlayerCuffed[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot do while cuffed");
    if (PlayerTazed[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot do while tazed");
    if (PlayerTied[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot do while tied");
    if (Died[playerid] == 1) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Cannot use this command while dead.");
    if(PlayerInfo[playerid][pFaction] == 1 && PlayerInfo[playerid][pRank] <= 2 || PlayerInfo[playerid][pAdministrator] > 0)
    {
        new Float:NearYou[3];
        GetPlayerPos(giveplayerid, NearYou[0], NearYou[1], NearYou[2]);
        if(!IsPlayerInRangeOfPoint(playerid, 1.0, NearYou[0], NearYou[1], NearYou[2])) //1.0 is the range, try changing it if you don't like 1.0
        {
            SendClientMessage(playerid,-1,"You must be near the player!");
            return 1;
        }
        if(giveplayerid != INVALID_PLAYER_ID)
        {
            new wep1[128];
            PlayerInfo[giveplayerid][pWepLic] = 1;
            format(wep1, sizeof(wep1), "gives %s a weapon license.",GetPlayerNameEx(giveplayerid));
            PlayerActionMessage(playerid,15.0,wep1);
            new give1[128];
            format(give1, sizeof(give1), "You have given %s a weapon license.", GetPlayerNameEx(giveplayerid));
            SendClientMessage(playerid, COLOR_WHITE, give1);
        }
        // don't need another bracket here :)
     }
     else
     {
        SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
     }
     return 1;
}
-FalconX
Reply
#4

Quote:
Originally Posted by FalconX
Посмотреть сообщение
You seriously need to learn how to indent your code. Well anyway, I checked your script and saw there was a useless bracket, well give it a try, I hope it helps

pawn Код:
CMD:givegunlicense(playerid, params[])
{
    new targetid;
    if(sscanf(params, "us[128]", targetid)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /giveweaponlicense [playerid/partofname]");
    if (playerid == targetid) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot blind yourself.");
    if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "SERVER: This player is not connected.");
    if (PlayerCuffed[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot do while cuffed");
    if (PlayerTazed[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot do while tazed");
    if (PlayerTied[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "SERVER: You cannot do while tied");
    if (Died[playerid] == 1) return SendClientMessage(playerid, COLOR_WHITE, "SERVER: Cannot use this command while dead.");
    if(PlayerInfo[playerid][pFaction] == 1 && PlayerInfo[playerid][pRank] <= 2 || PlayerInfo[playerid][pAdministrator] > 0)
    {
        new Float:NearYou[3];
        GetPlayerPos(giveplayerid, NearYou[0], NearYou[1], NearYou[2]);
        if(!IsPlayerInRangeOfPoint(playerid, 1.0, NearYou[0], NearYou[1], NearYou[2])) //1.0 is the range, try changing it if you don't like 1.0
        {
            SendClientMessage(playerid,-1,"You must be near the player!");
            return 1;
        }
        if(giveplayerid != INVALID_PLAYER_ID)
        {
            new wep1[128];
            PlayerInfo[giveplayerid][pWepLic] = 1;
            format(wep1, sizeof(wep1), "gives %s a weapon license.",GetPlayerNameEx(giveplayerid));
            PlayerActionMessage(playerid,15.0,wep1);
            new give1[128];
            format(give1, sizeof(give1), "You have given %s a weapon license.", GetPlayerNameEx(giveplayerid));
            SendClientMessage(playerid, COLOR_WHITE, give1);
        }
        // don't need another bracket here :)
     }
     else
     {
        SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command.");
     }
     return 1;
}
-FalconX
Thanks man, i try to learn about ZCMD
Reply
#5

Quote:
Originally Posted by N0FeaR
Посмотреть сообщение
Thanks man, i try to learn about ZCMD
It's alright mate

-FalconX
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)