Error 029 +1 Rep
#1

Today i created a cmd called "/norelease" meaning if an admin /norelease you you can't be free even they tried to /release you but the bad thing happen. I tried to put the pRelease on playerinfo i already did that now a error appears

The error code
Код:
C:\Users\Windows7\Desktop\Microsoft Corporation ©\replace\Irish Verse\gamemodes\IVRP.pwn(26032) : warning 211: possibly unintended assignment
C:\Users\Windows7\Desktop\Microsoft Corporation ©\replace\Irish Verse\gamemodes\IVRP.pwn(26057) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Код:
CMD:release(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 3) return SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
	{
		if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
 		{
  			SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
			return 1;
   		}
		if(PlayerInfo[playerid][pRelease] = 0)
		{
		new string[128], giveplayerid, reason[64];
		if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /release [playerid/partofname] [reason]");

		if(IsPlayerConnected(giveplayerid))
		{
			format(string, sizeof(string), "AdmCmd: %s has been released from prison by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
			Log("logs/admin.log", string);
			format(string, sizeof(string), "AdmCmd: %s has been released from prison by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
			SendClientMessageToAllEx(COLOR_LIGHTRED, string);
			PlayerInfo[giveplayerid][pJailed] = 0;
			PlayerInfo[giveplayerid][pWantedLevel] = 0;
			SetPlayerToTeamColor(giveplayerid);
			SetPlayerWantedLevel(giveplayerid, 0);
			PlayerInfo[giveplayerid][pJailTime] = 0;
			SetPlayerPos(giveplayerid, 1529.6,-1691.2,13.3);
			SetPlayerInterior(giveplayerid,0);
			PlayerInfo[giveplayerid][pInt] = 0;
			SetPlayerVirtualWorld(giveplayerid, 0);
			PlayerInfo[giveplayerid][pVW] = 0;
			PhoneOnline[giveplayerid] = 0;
			}
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You can't release a player with /norelease cmd!");
	}
	return 1;
}
Also fix the warnings. +1 Rep
Reply
#2

pawn Код:
if(PlayerInfo[playerid][pRelease] == 0)
= for setting
== for comparing/checking (also || !=)
Reply
#3

Код:
C:\Users\Windows7\Desktop\Microsoft Corporation ©\replace\Irish Verse\gamemodes\IVRP.pwn(26057) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
And now i have problem in 'else'

Код:
CMD:release(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 3) return SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
	{
		if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
 		{
  			SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
			return 1;
   		}
		if(PlayerInfo[playerid][pRelease] == 0)
		{
		new string[128], giveplayerid, reason[64];
		if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /release [playerid/partofname] [reason]");

		if(IsPlayerConnected(giveplayerid))
		{
			format(string, sizeof(string), "AdmCmd: %s has been released from prison by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
			Log("logs/admin.log", string);
			format(string, sizeof(string), "AdmCmd: %s has been released from prison by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
			SendClientMessageToAllEx(COLOR_LIGHTRED, string);
			PlayerInfo[giveplayerid][pJailed] = 0;
			PlayerInfo[giveplayerid][pWantedLevel] = 0;
			SetPlayerToTeamColor(giveplayerid);
			SetPlayerWantedLevel(giveplayerid, 0);
			PlayerInfo[giveplayerid][pJailTime] = 0;
			SetPlayerPos(giveplayerid, 1529.6,-1691.2,13.3);
			SetPlayerInterior(giveplayerid,0);
			PlayerInfo[giveplayerid][pInt] = 0;
			SetPlayerVirtualWorld(giveplayerid, 0);
			PlayerInfo[giveplayerid][pVW] = 0;
			PhoneOnline[giveplayerid] = 0;
			}
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You can't release a player with /norelease cmd!");
	}
	return 1;
}
Reply
#4

That's because of this:

pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 3) return SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
Remove that, or remove the else statement where the error occurs.
Reply
#5

Quote:
Originally Posted by DobbysGamertag
Посмотреть сообщение
That's because of this:

pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 3) return SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
Remove that, or remove the else statement where the error occurs.
Okay i tried this[

Код:
CMD:release(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 3)
	{
		if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
 		{
  			SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
			return 1;
   		}
		if(PlayerInfo[playerid][pRelease] == 0)
		{
		new string[128], giveplayerid, reason[64];
		if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /release [playerid/partofname] [reason]");

		if(IsPlayerConnected(giveplayerid))
		{
			format(string, sizeof(string), "AdmCmd: %s has been released from prison by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
			Log("logs/admin.log", string);
			format(string, sizeof(string), "AdmCmd: %s has been released from prison by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
			SendClientMessageToAllEx(COLOR_LIGHTRED, string);
			PlayerInfo[giveplayerid][pJailed] = 0;
			PlayerInfo[giveplayerid][pWantedLevel] = 0;
			SetPlayerToTeamColor(giveplayerid);
			SetPlayerWantedLevel(giveplayerid, 0);
			PlayerInfo[giveplayerid][pJailTime] = 0;
			SetPlayerPos(giveplayerid, 1529.6,-1691.2,13.3);
			SetPlayerInterior(giveplayerid,0);
			PlayerInfo[giveplayerid][pInt] = 0;
			SetPlayerVirtualWorld(giveplayerid, 0);
			PlayerInfo[giveplayerid][pVW] = 0;
			PhoneOnline[giveplayerid] = 0;
			}
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You can't release a player with /norelease cmd!");
	}
	return 1;
}
But if they tried to /release it, if the player is in the /norelease option what is the msg ?

EDIT:

how about if they are not admin what will be the msg

EDIT:

already fixed

Код:
CMD:release(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 3)
	{
		if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
 		{
  			SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
			return 1;
   		}
		if(PlayerInfo[playerid][pRelease] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "You can't release a player with /norelease cmd!");
		{
		new string[128], giveplayerid, reason[64];
		if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /release [playerid/partofname] [reason]");

		if(IsPlayerConnected(giveplayerid))
		{
			format(string, sizeof(string), "AdmCmd: %s has been released from prison by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
			Log("logs/admin.log", string);
			format(string, sizeof(string), "AdmCmd: %s has been released from prison by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
			SendClientMessageToAllEx(COLOR_LIGHTRED, string);
			PlayerInfo[giveplayerid][pJailed] = 0;
			PlayerInfo[giveplayerid][pWantedLevel] = 0;
			SetPlayerToTeamColor(giveplayerid);
			SetPlayerWantedLevel(giveplayerid, 0);
			PlayerInfo[giveplayerid][pJailTime] = 0;
			SetPlayerPos(giveplayerid, 1529.6,-1691.2,13.3);
			SetPlayerInterior(giveplayerid,0);
			PlayerInfo[giveplayerid][pInt] = 0;
			SetPlayerVirtualWorld(giveplayerid, 0);
			PlayerInfo[giveplayerid][pVW] = 0;
			PhoneOnline[giveplayerid] = 0;
			}
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
	}
	return 1;
}
Reply
#6

PHP код:
CMD:release(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 3)
    {
        if(
AdminDuty[playerid] != && PlayerInfo[playerid][pAdmin] < 6)
         {
              
SendClientMessage(playerid,COLOR_WHITE"You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
            return 
1;
           }
        if(
PlayerInfo[playerid][pRelease] == 0)
        {
        new 
string[128], giveplayeridreason[64];
        if(
sscanf(params"us[64]"giveplayeridreason)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /release [playerid/partofname] [reason]");
        if(
IsPlayerConnected(giveplayerid))
        {
            
format(stringsizeof(string), "AdmCmd: %s has been released from prison by %s, reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
            
Log("logs/admin.log"string);
            
format(stringsizeof(string), "AdmCmd: %s has been released from prison by %s, reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
            
SendClientMessageToAllEx(COLOR_LIGHTREDstring);
            
PlayerInfo[giveplayerid][pJailed] = 0;
            
PlayerInfo[giveplayerid][pWantedLevel] = 0;
            
SetPlayerToTeamColor(giveplayerid);
            
SetPlayerWantedLevel(giveplayerid0);
            
PlayerInfo[giveplayerid][pJailTime] = 0;
            
SetPlayerPos(giveplayerid1529.6,-1691.2,13.3);
            
SetPlayerInterior(giveplayerid,0);
            
PlayerInfo[giveplayerid][pInt] = 0;
            
SetPlayerVirtualWorld(giveplayerid0);
            
PlayerInfo[giveplayerid][pVW] = 0;
            
PhoneOnline[giveplayerid] = 0;
        }
    }
    else return 
SendClientMessage(playeridCOLOR_GRAD1"You can't release a player with /norelease cmd!");
    return 
1;

Reply
#7

Quote:
Originally Posted by BleverCastard
Посмотреть сообщение
PHP код:
CMD:release(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 3)
    {
        if(
AdminDuty[playerid] != && PlayerInfo[playerid][pAdmin] < 6)
         {
              
SendClientMessage(playerid,COLOR_WHITE"You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
            return 
1;
           }
        if(
PlayerInfo[playerid][pRelease] == 0)
        {
        new 
string[128], giveplayeridreason[64];
        if(
sscanf(params"us[64]"giveplayeridreason)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /release [playerid/partofname] [reason]");
        if(
IsPlayerConnected(giveplayerid))
        {
            
format(stringsizeof(string), "AdmCmd: %s has been released from prison by %s, reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
            
Log("logs/admin.log"string);
            
format(stringsizeof(string), "AdmCmd: %s has been released from prison by %s, reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
            
SendClientMessageToAllEx(COLOR_LIGHTREDstring);
            
PlayerInfo[giveplayerid][pJailed] = 0;
            
PlayerInfo[giveplayerid][pWantedLevel] = 0;
            
SetPlayerToTeamColor(giveplayerid);
            
SetPlayerWantedLevel(giveplayerid0);
            
PlayerInfo[giveplayerid][pJailTime] = 0;
            
SetPlayerPos(giveplayerid1529.6,-1691.2,13.3);
            
SetPlayerInterior(giveplayerid,0);
            
PlayerInfo[giveplayerid][pInt] = 0;
            
SetPlayerVirtualWorld(giveplayerid0);
            
PlayerInfo[giveplayerid][pVW] = 0;
            
PhoneOnline[giveplayerid] = 0;
        }
    }
    else return 
SendClientMessage(playeridCOLOR_GRAD1"You can't release a player with /norelease cmd!");
    return 
1;

Nice try but it will result for 26 errors.
Reply
#8

My bad, missing bracket.
PHP код:
CMD:release(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 3)
    {
        if(
AdminDuty[playerid] != && PlayerInfo[playerid][pAdmin] < 6)
         {
              
SendClientMessage(playerid,COLOR_WHITE"You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
            return 
1;
           }
        if(
PlayerInfo[playerid][pRelease] == 0)
        {
            new 
string[128], giveplayeridreason[64];
            if(
sscanf(params"us[64]"giveplayeridreason)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /release [playerid/partofname] [reason]");

            if(
IsPlayerConnected(giveplayerid))
            {
                
format(stringsizeof(string), "AdmCmd: %s has been released from prison by %s, reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                
Log("logs/admin.log"string);
                
format(stringsizeof(string), "AdmCmd: %s has been released from prison by %s, reason: %s"GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
                
SendClientMessageToAllEx(COLOR_LIGHTREDstring);
                
PlayerInfo[giveplayerid][pJailed] = 0;
                
PlayerInfo[giveplayerid][pWantedLevel] = 0;
                
SetPlayerToTeamColor(giveplayerid);
                
SetPlayerWantedLevel(giveplayerid0);
                
PlayerInfo[giveplayerid][pJailTime] = 0;
                
SetPlayerPos(giveplayerid1529.6,-1691.2,13.3);
                
SetPlayerInterior(giveplayerid,0);
                
PlayerInfo[giveplayerid][pInt] = 0;
                
SetPlayerVirtualWorld(giveplayerid0);
                
PlayerInfo[giveplayerid][pVW] = 0;
                
PhoneOnline[giveplayerid] = 0;
            }
        }
    }
    else return 
SendClientMessage(playeridCOLOR_GRAD1"You can't release a player with /norelease cmd!");
    return 
1;

Reply
#9

Helo,

Код:
CMD:release(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
    {
        if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
         {
              SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
            return 1;
         }
        if(PlayerInfo[playerid][pRelease] == 0)
        {
        new string[128], giveplayerid, reason[64];
        if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /release [playerid/partofname] [reason]");

        if(IsPlayerConnected(giveplayerid))
        	{
            format(string, sizeof(string), "AdmCmd: %s has been released from prison by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
            Log("logs/admin.log", string);
            format(string, sizeof(string), "AdmCmd: %s has been released from prison by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
            SendClientMessageToAllEx(COLOR_LIGHTRED, string);
            PlayerInfo[giveplayerid][pJailed] = 0;
            PlayerInfo[giveplayerid][pWantedLevel] = 0;
            SetPlayerToTeamColor(giveplayerid);
            SetPlayerWantedLevel(giveplayerid, 0);
            PlayerInfo[giveplayerid][pJailTime] = 0;
            SetPlayerPos(giveplayerid, 1529.6,-1691.2,13.3);
            SetPlayerInterior(giveplayerid,0);
            PlayerInfo[giveplayerid][pInt] = 0;
            SetPlayerVirtualWorld(giveplayerid, 0);
            PlayerInfo[giveplayerid][pVW] = 0;
            PhoneOnline[giveplayerid] = 0;
        	}
		}
	}
    else return SendClientMessage(playerid, COLOR_GRAD1, "You can't release a player with /norelease cmd!");
    return 1;
}
Why the user who is doing /release if he is pRelease = 1 he can't use it ? I want if they type /release with the person who is under pRelease = 1 there will be a msg, the thing is they can still /release it because the cmd only checks the user who is using it not the one who is under the pRelease.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)