17.08.2012, 16:20
How do I disable /go command if im in a race or deathmatch?
Example: Im gone to /mini and I do /go [playerid] << how do i disabled this. So i am not just teleporting to someone and just leaving deathmatch like a cat.
Example: Im gone to /mini and I do /go [playerid] << how do i disabled this. So i am not just teleporting to someone and just leaving deathmatch like a cat.
pawn Код:
CMD:go(playerid, params[])
{
new ID;//creates a new something idk what we call it :P but it is defined later on or used in something this 1 is used in next line
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFFFFFFFF, "{FFFF00}Usage: /go [PlayerID/PartofName]");//checks if you have written something after /goto if no it sends error
if(!IsPlayerConnected(ID) || ID == playerid) return SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}This player is Offline or it is Yourself");
if(GetPVarInt(playerid, "GotoEnabled") == 0) return GameTextForPlayer(playerid,"~r~Goes is Disabled",2000,3);
if(pInEvent[ID] == 1) return GameTextForPlayer(playerid,"Player is in DM/Race",2000,3);
if(GetPVarInt(playerid, "Jailed") == 1) return GameTextForPlayer(playerid,"Player is Jailed",2000,3);
new Float:x, Float:y, Float:z, name[MAX_PLAYER_NAME], str[64], i, vw; //creates new variables to store floats, strings and values
GetPlayerPos(ID, x, y, z);//gets the player id(which we have entered after /goto position and like saves them into x,y,z defined above as floats
i = GetPlayerInterior(ID);
vw = GetPlayerVirtualWorld(ID);
if(i) SetPlayerInterior(playerid, i);
if(vw) SetPlayerVirtualWorld(playerid, vw);
if(IsPlayerInAnyVehicle(playerid))
{
if(i)
{
LinkVehicleToInterior(GetPlayerVehicleID(playerid), i);
DestroyVehicle(GetPlayerVehicleID(playerid));
}
if(vw) SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), vw);
SetVehiclePos(GetPlayerVehicleID(playerid), x + 1, y + 1, z);
}
else SetPlayerPos(playerid, x + 1, y + 1, z);
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(str, sizeof(str), "{FFFF00}(/go) %s (%d) has teleported to you", name, playerid);
SendClientMessage(ID, 0xFFFFFFFF, str);
return 1;
}