Help Please
#1

I have a problem in this error

Код:
COMMAND:rob(playerid, params[])
{
	if (PlayerInfo[playerid][pSpawned] == 1)
	{

			new idx,giveplayerid,string[256],tmp[256],amount;

			tmp = strtok(params, idx);


			if (!strlen(tmp))
			{
				new Players;

				for (new i = 0; i < GetMaxPlayers(); i++)
				{
					if (IsPlayerConnected(i) && i != playerid && PlayerInfo[i][pSpawned] == 1 && GetDistanceBetweenPlayers(playerid,i) < 10)
					{

						Players ++;

						if (Players > 0)giveplayerid = i; break;
					}
				}

				if (Players == 0)
					return SendClientMessage(playerid, COLOR_ERROR, "No Players Close Enough To Rob.");


			}
				else
				{
					giveplayerid = strval(tmp);

					if (!IsPlayerConnected(giveplayerid))
					{
						format(string, sizeof(string), "That Player Is Not Connected.");
						SendClientMessage(playerid, COLOR_ERROR, string);
						return 1;
					}
				}



			if (giveplayerid == playerid)
			{
				SendClientMessage(playerid, COLOR_ERROR, "You Cannot Rob Yourself.");
				return 1;
			}

			if (PlayerInfo[playerid][pJailed] == 1)
			{
				SendClientMessage(playerid, COLOR_ERROR, "You Cannot Use This Command In Jail.");
				return 1;
			}

			if (GetDistanceBetweenPlayers(playerid,giveplayerid) > 3)    {
				format(string, sizeof(string), "%s (%d) Is Not Close Enough.  You Cannot Rob %s.",PlayerInfo[giveplayerid][pName],giveplayerid,ObjectGenderPronouns[PlayerInfo[giveplayerid][pGender]]);
				SendClientMessage(playerid, COLOR_ERROR, string);
				return 1;
			}

			if (GetPlayerVirtualWorld(playerid) != GetPlayerVirtualWorld(giveplayerid))
			{
				format(string, sizeof(string), "%s (%d) Is Not Close Enough.  You Cannot Rob %s.",PlayerInfo[giveplayerid][pName],giveplayerid,ObjectGenderPronouns[PlayerInfo[giveplayerid][pGender]]);
				SendClientMessage(playerid, COLOR_ERROR, string);
				return 1;
			}

			if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && GetPlayerState(giveplayerid) != PLAYER_STATE_ONFOOT)
			{
				format(string, sizeof(string), "%s (%d) Is Not Close Enough.  You Cannot Rob %s.",PlayerInfo[giveplayerid][pName],giveplayerid,ObjectGenderPronouns[PlayerInfo[giveplayerid][pGender]]);
				SendClientMessage(playerid, COLOR_ERROR, string);
				return 1;
			}

			if (GetPlayerState(playerid) != PLAYER_STATE_ONFOOT && GetPlayerState(giveplayerid) == PLAYER_STATE_ONFOOT)
			{
				format(string, sizeof(string), "%s (%d) Is Not Close Enough.  You Cannot Rob %s.",PlayerInfo[giveplayerid][pName],giveplayerid,ObjectGenderPronouns[PlayerInfo[giveplayerid][pGender]]);
				SendClientMessage(playerid, COLOR_ERROR, string);
				return 1;
			}


			if (PlayerInfo[playerid][pRobTime] > 0)
			{
				SendClientMessage(playerid, COLOR_ERROR, "Please Wait Before Attempting To Rob Someone Again.");
				return 1;
			}
			if(PlayerInfo[playerid][pJailed] == 1)
			{
				SendClientMessage(playerid, COLOR_ERROR, "You Can't use this command In Jail.");
				return 1;
			}

       switch(random(10))
		{
			case 1..5 :
			{
				PlayerInfo[playerid][pRobTime] = 30;
				amount = GetPlayerMoney(giveplayerid)/4;
				if(GetPlayerMoney(giveplayerid) >= 1500000)
				{
					amount = 500000;

                amount = GetPlayerMoney(giveplayerid)/32;

				format(string, sizeof(string), "You Have Robbed $%d From %s (%d).",amount,PlayerInfo[giveplayerid][pName],giveplayerid);
				SendClientMessage(playerid, COLOR_SKYBLUE, string);

				format(string, sizeof(string), "ROBBED %s~N~~G~$%d",PlayerInfo[giveplayerid][pName],amount);
				GameTextForPlayer(playerid,string, 4000, 3);

				format(string, sizeof(string), "%s (%d) Has Robbed $%d From You.",PlayerInfo[playerid][pName],playerid,amount);
				SendClientMessage(giveplayerid, COLOR_SKYBLUE, string);

				format(string, sizeof(string), "ROBBED BY %s~n~~G~$%d",PlayerInfo[playerid][pName],amount);
				GameTextForPlayer(giveplayerid,string, 4000, 3);


				LastRobbed[playerid] = giveplayerid;
				GivePlayerMoney(giveplayerid, - amount);
				GivePlayerMoney(playerid, amount);

				SetPlayerScore(playerid,GetPlayerScore(playerid) + 1);
				SetPlayerScore(giveplayerid,GetPlayerScore(giveplayerid) - 1);

			}
   			case 6..9 :
			{
				PlayerInfo[playerid][pRobTime] = 20;
				format(string, sizeof(string), "You Have Failed To Rob %s (%d).",PlayerInfo[playerid][pName],giveplayerid);
				SendClientMessage(playerid, COLOR_SKYBLUE, string);

				format(string, sizeof(string), "Robbery Attempt Failed"PlayerInfo[playerid][pName],amount);
				GameTextForPlayer(playerid,string, 4000, 3);

				format(string, sizeof(string), "%s (%d) Has Failed To Rob You.",PlayerInfo[playerid][pName],playerid);
				SendClientMessage(giveplayerid, COLOR_SKYBLUE, string);
			}
		}







	}
		}
	}else{
		SendClientMessage(playerid, COLOR_ERROR, "You Cannot Use This Command When You're Dead.");
	}

	return 1;
}
When i compile i get this error's

Код:
D:\Revolution DM\gamemodes\DM.pwn(20054) : error 014: invalid statement; not in switch
D:\Revolution DM\gamemodes\DM.pwn(20054) : warning 215: expression has no effect
D:\Revolution DM\gamemodes\DM.pwn(20054) : error 001: expected token: ";", but found ".."
D:\Revolution DM\gamemodes\DM.pwn(20054) : error 029: invalid expression, assumed zero
D:\Revolution DM\gamemodes\DM.pwn(20054) : fatal error 107: too many error messages on one line
How to fix this?
Reply
#2

line 20054?
Reply
#3

bracket ~.~

PHP код:
COMMAND:rob(playeridparams[]){
    if(
PlayerInfo[playerid][pSpawned] == 1){
        new 
idx,giveplayerid,string[256],tmp[256],amount;
        
tmp strtok(paramsidx);
        if(!
strlen(tmp)){
            new 
Players;
            for(new 
0GetMaxPlayers(); i++){
                if(
IsPlayerConnected(i) && != playerid && PlayerInfo[i][pSpawned] == && GetDistanceBetweenPlayers(playerid,i) < 10){
                    
Players ++;
                    if(
Players 0giveplayerid i; break;
                }
            }
            if(
Players == 0) return SendClientMessage(playeridCOLOR_ERROR"No Players Close Enough To Rob.");
        } else {
            
giveplayerid strval(tmp);
            if(!
IsPlayerConnected(giveplayerid)){
                
format(stringsizeof(string), "That Player Is Not Connected.");
                
SendClientMessage(playeridCOLOR_ERRORstring);
                return 
1;
            }
        }
        if(
giveplayerid == playerid){
            
SendClientMessage(playeridCOLOR_ERROR"You Cannot Rob Yourself.");
            return 
1;
        }
        if(
PlayerInfo[playerid][pJailed] == 1){
            
SendClientMessage(playeridCOLOR_ERROR"You Cannot Use This Command In Jail.");
            return 
1;
        }
        if(
GetDistanceBetweenPlayers(playerid,giveplayerid) > 3){
            
format(stringsizeof(string), "%s(%d) Is Not Close Enough.  You Cannot Rob %s.",PlayerInfo[giveplayerid][pName],giveplayerid,ObjectGenderPronouns[PlayerInfo[giveplayerid][pGender]]);
            
SendClientMessage(playeridCOLOR_ERRORstring);
            return 
1;
        }
        if(
GetPlayerVirtualWorld(playerid) != GetPlayerVirtualWorld(giveplayerid)){
            
format(stringsizeof(string), "%s(%d) Is Not Close Enough.  You Cannot Rob %s.",PlayerInfo[giveplayerid][pName],giveplayerid,ObjectGenderPronouns[PlayerInfo[giveplayerid][pGender]]);
            
SendClientMessage(playeridCOLOR_ERRORstring);
            return 
1;
        }
        if(
GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && GetPlayerState(giveplayerid) != PLAYER_STATE_ONFOOT){
            
format(stringsizeof(string), "%s(%d) Is Not Close Enough.  You Cannot Rob %s.",PlayerInfo[giveplayerid][pName],giveplayerid,ObjectGenderPronouns[PlayerInfo[giveplayerid][pGender]]);
            
SendClientMessage(playeridCOLOR_ERRORstring);
            return 
1;
        }
        if(
GetPlayerState(playerid) != PLAYER_STATE_ONFOOT && GetPlayerState(giveplayerid) == PLAYER_STATE_ONFOOT){
            
format(stringsizeof(string), "%s(%d) Is Not Close Enough.  You Cannot Rob %s.",PlayerInfo[giveplayerid][pName],giveplayerid,ObjectGenderPronouns[PlayerInfo[giveplayerid][pGender]]);
            
SendClientMessage(playeridCOLOR_ERRORstring);
            return 
1;
        }
        if(
PlayerInfo[playerid][pRobTime] > 0){
            
SendClientMessage(playeridCOLOR_ERROR"Please Wait Before Attempting To Rob Someone Again.");
            return 
1;
        }
        if(
PlayerInfo[playerid][pJailed] == 1){
            
SendClientMessage(playeridCOLOR_ERROR"You Can't use this command In Jail.");
            return 
1;
        }
        switch(
random(10)){
            case 
1..5 : {
                
PlayerInfo[playerid][pRobTime] = 30;
                
amount GetPlayerMoney(giveplayerid)/4;
                if(
GetPlayerMoney(giveplayerid) >= 1500000){
                    
amount 500000;
                    
amount GetPlayerMoney(giveplayerid)/32;
                    
format(stringsizeof(string), "You Have Robbed $%d From %s(%d).",amount,PlayerInfo[giveplayerid][pName],giveplayerid);
                    
SendClientMessage(playeridCOLOR_SKYBLUEstring);
                    
format(stringsizeof(string), "ROBBED %s~N~~G~$%d",PlayerInfo[giveplayerid][pName],amount);
                    
GameTextForPlayer(playerid,string40003);
                    
format(stringsizeof(string), "%s(%d) Has Robbed $%d From You.",PlayerInfo[playerid][pName],playerid,amount);
                    
SendClientMessage(giveplayeridCOLOR_SKYBLUEstring);
                    
format(stringsizeof(string), "ROBBED BY %s~n~~G~$%d",PlayerInfo[playerid][pName],amount);
                    
GameTextForPlayer(giveplayerid,string40003);
                    
LastRobbed[playerid] = giveplayerid;
                    
GivePlayerMoney(giveplayerid, - amount);
                    
GivePlayerMoney(playeridamount);
                    
SetPlayerScore(playerid,GetPlayerScore(playerid) + 1);
                    
SetPlayerScore(giveplayerid,GetPlayerScore(giveplayerid) - 1);
                }
            }
            case 
6..9 : {
                
PlayerInfo[playerid][pRobTime] = 20;
                
format(stringsizeof(string), "You Have Failed To Rob %s(%d).",PlayerInfo[playerid][pName],giveplayerid);
                
SendClientMessage(playeridCOLOR_SKYBLUEstring);
                
format(stringsizeof(string), "Robbery Attempt Failed"PlayerInfo[playerid][pName],amount);
                
GameTextForPlayer(playerid,string40003);
                
format(stringsizeof(string), "%s(%d) Has Failed To Rob You.",PlayerInfo[playerid][pName],playerid);
                
SendClientMessage(giveplayeridCOLOR_SKYBLUEstring);
            }
        }
    } else {
        
SendClientMessage(playeridCOLOR_ERROR"You Cannot Use This Command When You're Dead.");
    }
    return 
1;

Reply
#4

how?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)