SA-MP Forums Archive
Help me with these two errors. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help me with these two errors. (/showthread.php?tid=272028)



Help me with these two errors. - Shockey HD - 26.07.2011

Код:
CMD:God(playerid,params[])
{
    if(PlayerInfo[playerid][pAdminLevel] >=3)
	{
		SetPlayerHealth(playerid,999999);
		SendClientMessage(playerid,COLOR_GREEN,"|**God Activated**|");
            }
        }
        else return SendClientMessage(playerid,COLOR_RED,"  You are not allowed to use this command!");
        return 1;
    }
So thats my code but im getting two errors from

Код:
        else return SendClientMessage(playerid,COLOR_RED,"  You are not allowed to use this command!");
        return 1;
Код:
C:\Documents and Settings\Chris\Desktop\Desktop\Mastalol\Grand Theft Auto San Andreas Samp Server\filterscripts\SideShock.pwn(202) : error 010: invalid function or declaration
C:\Documents and Settings\Chris\Desktop\Desktop\Mastalol\Grand Theft Auto San Andreas Samp Server\filterscripts\SideShock.pwn(203) : error 010: invalid function or declaration
Can someone tell me whats wrong with it?


Re: Help me with these two errors. - geerdinho8 - 26.07.2011

Remove return 1;

And make sure you have COLOR_RED defined..


Re: Help me with these two errors. - [MG]Dimi - 26.07.2011

something is wrong
Код:
MD:God(playerid,params[])
{
if(PlayerInfo[playerid][pAdminLevel] >=3)
{
SetPlayerHealth(playerid,999999);
SendClientMessage(playerid,COLOR_GREEN,"|**God Activated**|");
}
}//and what about this one?
else return SendClientMessage(playerid,COLOR_RED,"  You are not allowed to use this command!");
return 1;
}

P.S Same colors = pairs


Re: Help me with these two errors. - Kush - 26.07.2011

PHP код:
CMD:god(playeridparams[]) 
{
    if(
PlayerInfo[playerid][pAdmin] >= 3)
    {
        
SetPlayerHealth(playerid10000000);
    }
    else
    {
        
SendClientMessage(playeridCOLOR_GREY"You are not authorized to use that command!");
    }
    return 
1;




Re: Help me with these two errors. - Shockey HD - 26.07.2011

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
something is wrong
Код:
MD:God(playerid,params[])
{
if(PlayerInfo[playerid][pAdminLevel] >=3)
{
SetPlayerHealth(playerid,999999);
SendClientMessage(playerid,COLOR_GREEN,"|**God Activated**|");
}
}//and what about this one?
else return SendClientMessage(playerid,COLOR_RED,"  You are not allowed to use this command!");
return 1;
}

P.S Same colors = pairs
The errors are gone thanks but, i get Unkown Server Command


Re: Help me with these two errors. - Shadoww5 - 26.07.2011

PHP код:
CMD:God(playerid,params[])
{
    
#pragma unused params
    
if(PlayerInfo[playerid][pAdminLevel] < 3) return SendClientMessage(playerid,COLOR_RED,"  You are not allowed to use this command!");
    
SetPlayerHealth(playerid,999999);
    
SendClientMessage(playerid,COLOR_GREEN,"|**God Activated**|");
    return 
1;




Re: Help me with these two errors. - Shockey HD - 26.07.2011

Quote:
Originally Posted by Kush
Посмотреть сообщение
PHP код:
CMD:god(playeridparams[]) 
{
    if(
PlayerInfo[playerid][pAdmin] >= 3)
    {
        
SetPlayerHealth(playerid10000000);
    }
    else
    {
        
SendClientMessage(playeridCOLOR_GREY"You are not authorized to use that command!");
    }
    return 
1;

Worked, cool thanks. Is this right for my other command?

Код:
CMD:godcar(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] >= 3)
    {
        if(IsPlayerInAnyVehicle(playerid))
			{
 			SetVehicleHealth(playerid, 999999);
			SendClientMessage(playerid,COLOR_GREEN,"**GodCar Activated**");
    }
    	else
    {
        SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command!");
    }
	    SendClientMessage(playerid, COLOR_RED, "You must be in a vehicle to use this command!");
	}
   	return 1;
}



Re: Help me with these two errors. - Shadoww5 - 26.07.2011

PHP код:
CMD:godcar(playeridparams[])
{
    
#pragma unused params
    
if(PlayerInfo[playerid][pAdminLevel] < 3) return SendClientMessage(playeridCOLOR_RED"You are not allowed to use this command!");
    if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playeridCOLOR_RED"You must be in a vehicle to use this command!");
    
SetVehicleHealth(GetPlayerVehicleID(playerid), 999999);
    
SendClientMessage(playerid,COLOR_GREEN,"**GodCar Activated**");
    return 
1;




Re: Help me with these two errors. - AndreT - 26.07.2011

Learn to indent your code properly and stupid errors like this won't happen. Besides that makes your code much more easily readable for you and whoever might steal your sources!