Simple "Fix Car" Command - 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: Simple "Fix Car" Command (
/showthread.php?tid=311885)
Simple "Fix Car" Command -
stormchaser206 - 18.01.2012
Код:
FixCar(playerid)
{
if(IsPlayerInAnyVehicle(playerid) == 1)
{
if(GetPlayerState(playerid) == 2)
{
SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
SendClientMessage(playerid,COLOR_GREEN,"Car fixed!");
}
else
{
SendClientMessage(playerid,COLOR_YELLOW,"You need to be the driver to fix your car");
}
}
else
{
SendClientMessage(playerid,COLOR_YELLOW,"You need to be in a vehicle to fix it!");
}
}
I got this from the following link:
http://weedarr.wikidot.com/cfunctions
Re: Simple "Fix Car" Command -
Konstantinos - 18.01.2012
pawn Код:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
if( strcmp( "/fix", cmdtext, true, 4 ) == 0 ) {
FixCar( playerid );
return 1;
}
return 0;
}
// At The Bottom
stock FixCar( playerid )
{
if( !IsPlayerInAnyVehicle( playerid ) ) return SendClientMessage( playerid, COLOR_YELLOW, "You need to be in a vehicle to fix it!" );
if( GetPlayerState( playerid ) != 2 ) return SendClientMessage( playerid, COLOR_YELLOW, "You need to be the driver to fix your car" );
SetVehicleHealth( GetPlayerVehicleID( playerid ), 1000.0 );
SendClientMessage( playerid, COLOR_GREEN, "Car fixed!" );
return 1;
}
Re: Simple "Fix Car" Command -
stormchaser206 - 18.01.2012
Oh, ty
Re: Simple "Fix Car" Command -
Konstantinos - 18.01.2012
No problem