Too many errors on 1 line ? ++REP
#1

Код:
CMD:jail(playerid, params[])
{
    if(pInfo[playerid][Admin] >= 2)
    {
        new id, time = 0, reason[50];
        if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTGREEN, "Usage: /Jail <Player ID> <Minutes> <Reason>");
        sscanf(params, "uis[50]", id, time, reason);
        if(IsPlayerConnected(id) && id != playerid)
        {
            if(pInfo[id][Jailed] == 1) return SendClientMessage(playerid,COLOR_LIGHTGREEN,"This player is already jailed. see /jailed");
            if(pInfo[playerid][Admin] <= pInfo[id][Admin]) return SendClientMessage(playerid,COLOR_LIGHTGREEN,"You cannot jail an administrator");
            if(!isnull(reason) && time == 0)
           	new string[128],Name[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];//ERROR LINE
           	GetPlayerName(playerid,Name,sizeof(Name));
           	GetPlayerName(id,name,sizeof(name));
   			format(string,sizeof(string),"Administrator %s has jailed player '%s' for %i minutes | Reason: %s",Name,name,time,reason);
		    SendClientMessageToAll(red,string);
		    pInfo[id][Jailed] = 1;
		    TogglePlayerControllable(id, false);
		    new Float:x, Float:y, Float:z;
			GetPlayerPos(id,x,y,z);
			SetPlayerCameraPos(id,x+7,y,z+5);
			SetPlayerCameraLookAt(id,x,y,z);
			JPlayer[id] = SetTimerEx("JailPlayer",3000,0,"d",id);
			if(GetPlayerState(id) == PLAYER_STATE_ONFOOT) SetPlayerSpecialAction(id,SPECIAL_ACTION_HANDSUP);
		    if(time >= 1)
			{
		    	Jtimer[id] = SetTimerEx("Unjail",time*1000*60,0,"u",id);
		    }
			return 1;
		}
    }
   	else return SendClientMessage(playerid,RED,"<!>You're not authorized to use this command!");
}
errors:
Код:
C:\Windows.old.000\Users\Youssf Hammad\Desktop\SA-MP related shit\Server\gamemodes\LSCnR.pwn(4945) : error 003: declaration of a local variable must appear in a compound block
C:\Windows.old.000\Users\Youssf Hammad\Desktop\SA-MP related shit\Server\gamemodes\LSCnR.pwn(4945) : error 017: undefined symbol "string"
C:\Windows.old.000\Users\Youssf Hammad\Desktop\SA-MP related shit\Server\gamemodes\LSCnR.pwn(4945) : warning 215: expression has no effect
C:\Windows.old.000\Users\Youssf Hammad\Desktop\SA-MP related shit\Server\gamemodes\LSCnR.pwn(4945) : error 001: expected token: ";", but found "]"
C:\Windows.old.000\Users\Youssf Hammad\Desktop\SA-MP related shit\Server\gamemodes\LSCnR.pwn(4945) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Thanks
Reply
#2

Your code:
pawn Код:
if (!isnull(reason) && time == 0)
new string[128], Name[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
It should be:
pawn Код:
if (!isnull(reason) && time == 0)
{
    new string[128], Name[MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
    ...
}
Reply
#3

Thanks, will rep when im able to
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)