[FIXED][DELTE THIS THREAD]possibly unintended assignment
#1

Код:
warning 211: possibly unintended assignment
Код:
CMD:arrest(playerid, params[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(GetPlayerState(i) == PLAYER_STATE_DRIVER || GetPlayerState(i) == PLAYER_STATE_PASSENGER)
		{
			SendClientMessage(playerid,-1,"You cannot arrest a suspect they are in a vehicle. Get them to exit the vehicle first.");
			return 1;
		}
	    new string[128];
    	if(GetPlayerClass[playerid] == COP_CLASS || GetPlayerClass[playerid] == ARMY_CLASS)
    	{
        	if(GetPlayerWantedLevel(i) >= 3)
        	{
        	    if(Cuffed[i] = 1)
        	    {
        	        if(sscanf(params,"ud", i)) return SendClientMessage(playerid, -1,"USAGE: /arrest [player id]");
            		GivePlayerMoney(playerid, 3000);
			  		SetPlayerScore(playerid, GetPlayerScore(playerid)+1);
			  		Jailed[i] = 1;
			  		JailTime[i] = 60;
			  		Cuffed[i] = 0;
			  		SetPlayerSpecialAction(i, 0);
			  		RemovePlayerAttachedObject(i, i);
			  		SetPlayerVirtualWorld(i, 10);
					SetPlayerFacingAngle(i, 360.0);
			  		SetPlayerInterior(i, 3);
			  		SetPlayerPos(i, 197.5662, 175.4800, 1004.0);
			  		SetPlayerWantedLevel(i, 0);
			  		SetPlayerHealth(i,99999);
			  		ResetPlayerWeapons(i);
			  		format(string,sizeof(string),"Police Officer %s(%d) Has arrested wanted suspect %s(%d).",GetNamee(playerid),playerid,GetNamee(i),i);
			  		SendClientMessageToAll(COLOR_ORANGE,string);
			  		return 1;
			  	}
			  	else
			  	{
	  	 			SendClientMessage(playerid, -1, "You Can't Cuff Innocents!");
			  	}
			}
    	}
   }
	return 1;
}
Код:
line: if(Cuffed[i] = 1)
Reply
#2

Change it to:

pawn Код:
if(Cuffed[i])
Reply
#3

if(Cuffed[i] = 1) To if(Cuffed[i] == 1)

PHP код:
CMD:arrest(playeridparams[])
{
    for(new 
0MAX_PLAYERSi++)
    {
        if(
GetPlayerState(i) == PLAYER_STATE_DRIVER || GetPlayerState(i) == PLAYER_STATE_PASSENGER)
        {
            
SendClientMessage(playerid,-1,"You cannot arrest a suspect they are in a vehicle. Get them to exit the vehicle first.");
            return 
1;
        }
        new 
string[128];
        if(
GetPlayerClass[playerid] == COP_CLASS || GetPlayerClass[playerid] == ARMY_CLASS)
        {
            if(
GetPlayerWantedLevel(i) >= 3)
            {
                if(
Cuffed[i] == 1)
                {
                    if(
sscanf(params,"ud"i)) return SendClientMessage(playerid, -1,"USAGE: /arrest [player id]");
                    
GivePlayerMoney(playerid3000);
                      
SetPlayerScore(playeridGetPlayerScore(playerid)+1);
                      
Jailed[i] = 1;
                      
JailTime[i] = 60;
                      
Cuffed[i] = 0;
                      
SetPlayerSpecialAction(i0);
                      
RemovePlayerAttachedObject(ii);
                      
SetPlayerVirtualWorld(i10);
                    
SetPlayerFacingAngle(i360.0);
                      
SetPlayerInterior(i3);
                      
SetPlayerPos(i197.5662175.48001004.0);
                      
SetPlayerWantedLevel(i0);
                      
SetPlayerHealth(i,99999);
                      
ResetPlayerWeapons(i);
                      
format(string,sizeof(string),"Police Officer %s(%d) Has arrested wanted suspect %s(%d).",GetNamee(playerid),playerid,GetNamee(i),i);
                      
SendClientMessageToAll(COLOR_ORANGE,string);
                      return 
1;
                  }
                  else
                  {
                       
SendClientMessage(playerid, -1"You Can't Cuff Innocents!");
                  }
            }
        }
   }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)