SA-MP Forums Archive
*** Not a descriptive title - ******. - 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)
+--- Thread: *** Not a descriptive title - ******. (/showthread.php?tid=395085)



*** Not a descriptive title - ******. - Nirzor - 25.11.2012

i need a system like CMD:Fix

i want it like to detect first if player is in any vehice if not then error message

and if in vehicle will get 100 health this will be the feature of TECHNICIAN class can someone do like this for me

+rep will be given


Re: Help (+rep) - iTzZh - 25.11.2012

Assuming you require the technician to be in the car of the person you want to have a fixed car....

Код:
CMD:fix(playerid, params[])
{
	if(IsPlayerInAnyVehicle(playerid))
	{
    	SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
	}
   	return 1;
}
(Sorry about horrid indentation, that happens when posting on here...)

Now all you need to do is probably add an if statement to check if the user is logged in and if the user is a technician. I don't know your variable names so I cannot do that for you.


Re: Help (+rep) - Nirzor - 25.11.2012

Thanks +rep i was just confused how to use IsPlayerInAnyVehicle i thought that variable IsPlayerInVehicle

thats y i had to make this post which is making me look like a noob as i can do thousand better things then this but

stuck in this variable


Re: Help (+rep) - B-Matt - 25.11.2012

PHP код:
CMD:fix(playeridparams[])
{
    new 
vehicleFloat:Health;
    
vehicle GetPlayerVehicleID(playerid);
    
GetVehicleHealth(vehicleHealth);
    
    if(
IsPlayerInAnyVehicle(playerid))
    {
        if(
Health 500.0) return SendClientMessage(playeridCOLOR_RED,"Doesn't need repairing!");
        else
        {
            
SetVehicleHealth(vehicle1000.0);
            
SendClientMessage(playeridCOLOR_GREEN"You fixed your vehicle!");
        }
    }
    else return 
SendClientMessage(playeridCOLOR_RED"You need to be in vehicle that you can fix it.");
    return 
1;

Here


Re: Help (+rep) - iTzZh - 25.11.2012

Quote:
Originally Posted by B-Matt
Посмотреть сообщение
PHP код:
CMD:fix(playeridparams[])
{
    new 
vehicleFloat:Health;
    
vehicle GetPlayerVehicleID(playerid);
    
GetVehicleHealth(vehicleHealth);
    
    if(
IsPlayerInAnyVehicle(playerid))
    {
        if(
Health 500.0) return SendClientMessage(playeridCOLOR_RED,"Doesn't need repairing!");
        else
        {
            
SetVehicleHealth(vehicle1000.0);
            
SendClientMessage(playeridCOLOR_GREEN"You fixed your vehicle!");
        }
    }
    else return 
SendClientMessage(playeridCOLOR_RED"You need to be in vehicle that you can fix it.");
    return 
1;

Here
Pffttt.... trying to show me up all fancy status :P Haha just kidding. I just wanted him to work a little :P