CMD:convidartodos(playerid, params[])
{
new
Float:x,
Float:y,
Float:z;
GetPlayerPos(playerid, x, y, z);
for (new i = 0; i < MAX_PLAYERS; i ++) if (!GetPVarFloat(i, "AdmX")) {
SendClientMessage(i, -1, "Um Administrador estб convidado todos do servidor para ir atй ele.");
SetPVarFloat(i, "AdmX", x);
SetPVarFloat(i, "AdmY", y);
SetPVarFloat(i, "AdmZ", z);
}
return 1;
}
CMD:aceitar(playerid, params[])
{
if (!GetPVarFloat(playerid, "AdmX"))
return 1;
SetPlayerPos(playerid, GetPVarFloat(playerid, "AdmX"), GetPVarFloat(playerid, "AdmY"), GetPVarFloat(playerid, "AdmZ"));
DeletePVar(playerid, "AdmX");
DeletePVar(playerid, "AdmY");
DeletePVar(playerid, "AdmZ");
return 1;
}
CMD:negar(playerid, params[])
{
if (!GetPVarFloat(playerid, "AdmX"))
return 1;
DeletePVar(playerid, "AdmX");
DeletePVar(playerid, "AdmY");
DeletePVar(playerid, "AdmZ");
return 1;
}
CMD:cancelarconvite(playerid, params[])
{
for (new i = 0; i < MAX_PLAYERS; i ++) if (GetPVarFloat(i, "AdmX")) {
DeletePVar(i, "AdmX");
DeletePVar(i, "AdmY");
DeletePVar(i, "AdmZ");
}
return 1;
}
new bool:CANCELADO; CMD:convidartodos(playerid, params[]) { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); for (new i = 0; i < MAX_PLAYERS; i ++) if (!GetPVarFloat(i, "AdmX")) { SendClientMessage(i, -1, "Um Administrador estб convidado todos do servidor para ir atй ele."); SetPVarFloat(i, "AdmX", x); SetPVarFloat(i, "AdmY", y); SetPVarFloat(i, "AdmZ", z); CANCELADO = false; } return 1; } CMD:aceitar(playerid, params[]) { if(CANCELADO == true) return SendClientMessage(playerid, -1, "Convites cancelados pelo Admin"); if (!GetPVarFloat(playerid, "AdmX")) return 1; SetPlayerPos(playerid, GetPVarFloat(playerid, "AdmX"), GetPVarFloat(playerid, "AdmY"), GetPVarFloat(playerid, "AdmZ")); DeletePVar(playerid, "AdmX"); DeletePVar(playerid, "AdmY"); DeletePVar(playerid, "AdmZ"); return 1; } CMD:negar(playerid, params[]) { if (!GetPVarFloat(playerid, "AdmX")) return 1; DeletePVar(playerid, "AdmX"); DeletePVar(playerid, "AdmY"); DeletePVar(playerid, "AdmZ"); return 1; } CMD:cancelarconvite(playerid, params[]) { for (new i = 0; i < MAX_PLAYERS; i ++) if (GetPVarFloat(i, "AdmX")) { DeletePVar(i, "AdmX"); DeletePVar(i, "AdmY"); DeletePVar(i, "AdmZ"); CANCELADO = true; } return 1; }
Com base no cуdigo do amigo acima:
Код:
new bool:CANCELADO; CMD:convidartodos(playerid, params[]) { new Float:x, Float:y, Float:z; GetPlayerPos(playerid, x, y, z); for (new i = 0; i < MAX_PLAYERS; i ++) if (!GetPVarFloat(i, "AdmX")) { SendClientMessage(i, -1, "Um Administrador estб convidado todos do servidor para ir atй ele."); SetPVarFloat(i, "AdmX", x); SetPVarFloat(i, "AdmY", y); SetPVarFloat(i, "AdmZ", z); CANCELADO = false; } return 1; } CMD:aceitar(playerid, params[]) { if(CANCELADO == true) return SendClientMessage(playerid, -1, "Convites cancelados pelo Admin"); if (!GetPVarFloat(playerid, "AdmX")) return 1; SetPlayerPos(playerid, GetPVarFloat(playerid, "AdmX"), GetPVarFloat(playerid, "AdmY"), GetPVarFloat(playerid, "AdmZ")); DeletePVar(playerid, "AdmX"); DeletePVar(playerid, "AdmY"); DeletePVar(playerid, "AdmZ"); return 1; } CMD:negar(playerid, params[]) { if (!GetPVarFloat(playerid, "AdmX")) return 1; DeletePVar(playerid, "AdmX"); DeletePVar(playerid, "AdmY"); DeletePVar(playerid, "AdmZ"); return 1; } CMD:cancelarconvite(playerid, params[]) { for (new i = 0; i < MAX_PLAYERS; i ++) if (GetPVarFloat(i, "AdmX")) { DeletePVar(i, "AdmX"); DeletePVar(i, "AdmY"); DeletePVar(i, "AdmZ"); CANCELADO = true; } return 1; } Algoritimo: se a bool cancelado, estiver true. Ngm poderб mais dar o comando |