Enable godmode command for vehicle -
Primard - 10.01.2015
My godmode command only works for the player not both the vehicle and the player, how can I do it?
here is my command code:
Код:
CMD:god(playerid, params[])
{
new str1[128], str2[128], admin[MAX_PLAYER_NAME], p[MAX_PLAYER_NAME], id, Float: health1, Float:health2;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, WHITE, "You must be Admin to use this command");
GetPlayerHealth(playerid, health1);
if(sscanf(params, "d", id))
{
if (health1==0.0)
{
SetPlayerHealth(playerid, 100.0);
return SendClientMessage(playerid,WHITE, "Back to mortality.");
}
if (health1>0.0)
{
SetPlayerHealth(playerid, 9999999999999999.0);
return SendClientMessage(playerid, WHITE, "You are god now!");
}
}
if(IsPlayerConnected(id))
{
GetPlayerName(playerid, admin, MAX_PLAYER_NAME);
GetPlayerName(id, p, MAX_PLAYER_NAME);
GetPlayerHealth(id, health2);
if (health2>0.0)
{
SetPlayerHealth(id, 9999999999999999.0);
format(str2, sizeof(str2), "You have successfully turned %s into god.", p);
SendClientMessage(playerid, WHITE, str2);
format(str1, sizeof(str1), "Admin %s has turned you into god!", admin);
SendClientMessage(id, WHITE, str1);
}
if (health2==0)
{
SetPlayerHealth(id, 100.0);
format(str2, sizeof(str2), "You have turned god %s into human.", p);
SendClientMessage(playerid, WHITE, str2);
return SendClientMessage(id, WHITE, "Back to mortality.");
}
}
else SendClientMessage(playerid, RED, "ERROR: Player is not connected.");
return 1;
}
Re: Enable godmode command for vehicle -
Divergent - 10.01.2015
I'll help you in a minute
Re: Enable godmode command for vehicle -
Divergent - 10.01.2015
Код:
// Under on playerconnect and OnPlayerDeath add IsPlayerGod[MAX_PLAYER] = false
public OnPlayerTakeDamage(
CMD:god(playerid, params[])
{
new str1[128], str2[128], admin[MAX_PLAYER_NAME], p[MAX_PLAYER_NAME], id, Float: health1, Float:health2;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, WHITE, "You must be Admin to use this command");
GetPlayerHealth(playerid, health1);
if(sscanf(params, "d", id))
{
if (health1==0.0)
{
IsplayerGod[playerid] = false;
SetPlayerHealth(playerid, 100.0);
return SendClientMessage(playerid,WHITE, "Back to mortality.");
}
if (health1>0.0)
{
IsPlayerGogd[playerid] = true;
SetPlayerHealth(playerid, 9999999999999999.0);
return SendClientMessage(playerid, WHITE, "You are god now!");
}
}
if(IsPlayerConnected(id))
{
GetPlayerName(playerid, admin, MAX_PLAYER_NAME);
GetPlayerName(id, p, MAX_PLAYER_NAME);
GetPlayerHealth(id, health2);
if (health2>0.0)
{
IsPlayerGod[playerid] = true;
SetPlayerHealth(id, 9999999999999999.0);
format(str2, sizeof(str2), "You have successfully turned %s into god.", p);
SendClientMessage(playerid, WHITE, str2);
format(str1, sizeof(str1), "Admin %s has turned you into god!", admin);
SendClientMessage(id, WHITE, str1);
}
if (health2==0)
{
IsPlayerGod[playerid] = false;
SetPlayerHealth(id, 100.0);
format(str2, sizeof(str2), "You have turned god %s into human.", p);
SendClientMessage(playerid, WHITE, str2);
return SendClientMessage(id, WHITE, "Back to mortality.");
}
}
else SendClientMessage(playerid, RED, "ERROR: Player is not connected.");
return 1
}
public OnPlayerEnterVehicle(playerid, vehicleid)
{
if(IsPlayerGod[playerid] = true)
{
SetVehicleHealth(vehicleid, 999999999);
}
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(IsPlayerGod[playerid] = true)
{
SetVehicleHealth(vehicleid, 10000);
}
return 1;
}
Re: Enable godmode command for vehicle -
Primard - 10.01.2015
So I just copy the new command over the old one and do the additions, correct?
Re: Enable godmode command for vehicle -
Primard - 10.01.2015
So the new command code is still only for admins to use right?
Re: Enable godmode command for vehicle -
Lynn - 10.01.2015
The code he provided is only for Rcon Admins.
So you have to be logged into RCON in-order to use it.
Re: Enable godmode command for vehicle -
Primard - 10.01.2015
thanks!
Re: Enable godmode command for vehicle -
Godde - 10.01.2015
Just needed that for OUR server ryt primard?

:P
Re: Enable godmode command for vehicle -
Primard - 10.01.2015
yeah
Re: Enable godmode command for vehicle -
Godde - 10.01.2015
lynn but primard can give us godmode ryt?