23.06.2010, 19:07
No offence, but if you don't know /flip, or /fix, then I'd rather you to get a /fix and /flip with strcmp, which I got for you.
Its easy to understand for beginners, only its a bit bigger.
The /fix (/repair) command - both types of command will work in the same strcmp
The /flip command
Its easy to understand for beginners, only its a bit bigger.
The /fix (/repair) command - both types of command will work in the same strcmp
pawn Код:
if(!strcmp(cmd, "/repair", true, 7) || strcmp(cmd, "/fix", true, 4) == 0)
{
new Float:vehhealth;
new veh;
veh = GetPlayerVehicleID(playerid);
GetVehicleHealth(veh, vehhealth);
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED,"ERROR: not in a vehicle!");
if (playerState == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_RED,"ERROR: be the driver to repair the vehicle");
SetVehicleHealth(veh,1000);
RepairVehicle(veh);
SendClientMessage(playerid, COLOR_GREEN,"You have repaired your vehicle");
return 1;
}
pawn Код:
if(strcmp("/flip", cmdtext, true) == 0)
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED,"ERROR: not in a vehicle!");
if (playerState == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_RED,"ERROR: be the driver to flip the vehicle");
new vehicle;
new Float:angle;
vehicle = GetPlayerVehicleID(playerid);
GetVehicleZAngle(vehicle, angle);
SetVehicleZAngle(vehicle, angle);
SendClientMessage(playerid, COLOR_GREEN, "You have flipped your vehicle");
return 1;
}