Addon the top of your gamemode!pawn Код:#pragma tabsize 0
Top of script:
OnGameModeInit/OnFilterScriptInit:pawn Код:forward vgod();new vgoded[MAX_PLAYERS];
Then anywhere under:pawn Код:SetTimer("vgod", 1000, 1);
Command:pawn Код:public vgod(){ for(new i=0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(vgoded[i]) { SetVehicleHealth(GetPlayerVehicleID(i),1000.0); } } } return 1;}
/Vgod will turn it on or off depending if its on or off.pawn Код:if (strcmp("/vgod", cmdtext, true) == 0) { if(vgoded[playerid] == 0) { vgoded[playerid] = 1; } else { vgoded[playerid] = 0; } return 1; }
pawn Код:#define Driver 0#define Passanger 2new Act[MAX_PLAYERS];new InCar[MAX_PLAYERS];new WhatCar[MAX_PLAYERS];pawn Код:public OnPlayerExitVehicle(playerid, vehicleid){ InCar[playerid] = 0; return 1;}public OnPlayerStateChange(playerid, newstate, oldstate){ if(Act[playerid] == 1) { if(oldstate == PLAYER_STATE_DRIVER) { if(newstate == PLAYER_STATE_ONFOOT) { if(InCar[playerid] == 1) { PutPlayerInVehicle(playerid, WhatCar[playerid], Driver); } } } if(oldstate == PLAYER_STATE_PASSENGER) { if(newstate == PLAYER_STATE_ONFOOT) { if(InCar[playerid] == 1) { PutPlayerInVehicle(playerid, WhatCar[playerid], Passanger); } } } if(oldstate == PLAYER_STATE_ONFOOT) { if(newstate == PLAYER_STATE_DRIVER || PLAYER_STATE_PASSENGER) { InCar[playerid] = 1; WhatCar[playerid] = GetPlayerVehicleID(playerid); } } } return 1;}public OnPlayerCommandText(playerid, cmdtext[]){ if (strcmp("/afon", cmdtext, true) == 0) { Act[playerid] = 1; GameTextForPlayer(playerid, "~w~Anti fall off bike is now ~g~on", 5000, 5); return 1; } if (strcmp("/afoff", cmdtext, true) == 0) { GameTextForPlayer(playerid, "~w~Anti fall off bike is now ~r~off", 5000, 5); Act[playerid] = 0; return 1; } return 0;}
Originally Posted by Serbish
1. You can set the Vehicles Health to max.
|
Originally Posted by [KMA
DlennartD ]
I know how to make a car god mode, but i want to give players the choise to put it on or off for the vehicle they are driving. |
if(strcmp(cmdtext, "/cargodon", true) == 0) { SetTimer for VehicleHealth }
if(strcmp(cmdtext, "/cargodon", true) == 0) { KillTimer for VehicleHealth }
if(strcmp(cmdtext,"/cargodon",true) == 0)
{
if(!IsPlayerInAnyVehicle(playerid)) return 0;
new vehicleid = GetPlayerVehicleID(playerid);
SetTimerEx("CarGodMode",1000,"i",vehicleid);
return 1;
}
public CarGodMode(vehicleid)
{
SetVehicleHealth(vehicleid,5000);
return 1;
}
if(strcmp(cmdtext,"/cargodon",true) == 0)
{
SetTimerEx("CarGodMode",1000,"i",playerid);
return 1;
}
public CarGodMode(playerid)
{
if(!IsPlayerInAnyVehicle(playerid)) return 0;
new vehicleid = GetPlayerVehicleID(playerid);
SetVehicleHealth(vehicleid,5000);
return 1;
}
Originally Posted by Seif_
Quote:
|
if(strcmp(cmdtext,"/cargodon",true) == 0) { if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in any vehicle to use godmode."); new vehicleid = GetPlayerVehicleID(playerid); SetVehicleHealth(vehicleid,99999); SendClientMessage(playerid, COLOR_GREEN, "Vehicles godmode turned on."); return 1; }
if(strcmp(cmdtext,"/cargodoff",true) == 0) { if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in any vehicle to turn godmode off."); new vehicleid = GetPlayerVehicleID(playerid); SetVehicleHealth(vehicleid,1000); SendClientMessage(playerid, COLOR_RED, "Vehicles godmode turned off."); return 1; }
forward vgod();
new vgoded[MAX_PLAYERS];
SetTimer("vgod", 1000, 1);
public vgod()
{
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(vgoded[i])
{
SetVehicleHealth(GetPlayerVehicleID(i),1000.0);
}
}
}
return 1;
}
if (strcmp("/vgod", cmdtext, true) == 0)
{
if(vgoded[playerid] == 0)
{
vgoded[playerid] = 1;
}
else
{
vgoded[playerid] = 0;
}
return 1;
}
Originally Posted by Mikep
... Scripting ... :P
|