public OnPlayerSpawn(playerid) { GivePlayerMoney(playerid, PocketMoney); SetPlayerHealth(playerid, 100000.0); SetTimer("stopgod", 30000,0); SendClientMessage(playerid, COLOR_RED, "You are invulnerable for 30 seconds after spawning to prevent spawncamping."); return 1; }
public stopgod(playerid)
{
SetPlayerHealth(playerid,100.0);
return 1;
}
SetTimerEx("stopgod",30000,0,"i",playerid);//i = integer (8), f = float (8.0), s = string ("8")
public OnPlayerSpawn(playerid) { GivePlayerMoney(playerid, PocketMoney); SetPlayerHealth(playerid, 100000.0); SetTimerEx("stopgod", 30000,0); SendClientMessage(playerid, COLOR_RED, "You are invulnerable for 30 seconds after spawning to prevent spawncamping."); return 1; } //--------------------------------------------------------- public stopgod(playerid) { SetPlayerHealth(playerid, 100.0); return 1; }
Originally Posted by biltong
Thanks!
Will report back on progress. EDIT: How would I go about integrating that into my code? I made another function like so: pawn Код:
|
public OnPlayerCommandText(playerid, cmdtext[0]) { { if (strcmp("/kill", cmdtext, true, 5) == 0) { SetPlayerHealth(playerid, 0.0); return 1; } if (strcmp("/r", cmdtext, true)) { new vehicleid = GetPlayerVehicleID(playerid); RepairVehicle(vehicleid); return 1; } else { return SendClientMessage(playerid,COLOR_RED, "You're not in a vehicle!"); } } return 1; //EDIT: I keep getting an unreachable code warning here. Why is it saying that? }
public OnPlayerCommandText(playerid, cmdtext[0])
{
if (strcmp("/kill", cmdtext, true, 5) == 0)
{
SetPlayerHealth(playerid, 0.0);
return 1;
}
if (strcmp("/r", cmdtext, true))
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid) RepairVehicle(vehicleid);
else SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle!");
return 1;
}
return 0;
}
if(IsPlayerInAnyVehicle(playerid)) RepairVehicle(vehicleid);
Originally Posted by biltong
I'd kiss you if I could. But:
Код:
if(IsPlayerInAnyVehicle(playerid)) RepairVehicle(vehicleid); Many thanks |
Originally Posted by bluray
one little thing not really important but to avoid passengers using /r and fixing others cars, (unless u want it like that)
replace the IsPlayeInAnyVehicle, with PState == PLAYER_STATE_DRIVER. but u cant just copy and past that needs to be defined and so on, but it saves annoying passengers. |
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)