26.07.2011, 20:42
Aproveitando o Topico eu uso o comando sу que diz "Apenas para Administradores" nгo sei por que, mais jб substitui o que obrigava a logar na rcon para usar
Tб ai o Codigo inteiro do FS
Tб ai o Codigo inteiro do FS
pawn Код:
#include <a_samp>
new Float:vida;
new Float:slx, Float:sly, Float:slz;
new admtrampando[MAX_PLAYERS];
enum pInfo
{
pAdmin
};
new PlayerInfo[MAX_PLAYERS][pInfo];
main()
{
print("AntiGodMod criado by Airton");
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' ')) {
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) {
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
ReturnUser(text[], playerid = INVALID_PLAYER_ID)
{
new pos = 0;
while (text[pos] < 0x21)
{
if (text[pos] == 0) return INVALID_PLAYER_ID;
pos++;
}
new userid = INVALID_PLAYER_ID;
if (IsNumeric(text[pos]))
{
userid = strval(text[pos]);
if (userid >=0 && userid < MAX_PLAYERS)
{
if(!IsPlayerConnected(userid))
{
userid = INVALID_PLAYER_ID;
}
else
{
return userid;
}
}
}
new len = strlen(text[pos]);
new count = 0;
new name[MAX_PLAYER_NAME];
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
GetPlayerName(i, name, sizeof (name));
if (strcmp(name, text[pos], true, len) == 0) // Check segment of name
{
if (len == strlen(name)) // Exact match
{
return i; // Return the exact player on an exact match
// Otherwise if there are two players:
// Me and MeYou any time you entered Me it would find both
// And never be able to return just Me's id
}
else // Partial match
{
count++;
userid = i;
}
}
}
}
if (count != 1)
{
if (playerid != INVALID_PLAYER_ID)
{
if (count)
{
SendClientMessage(playerid, 0xFF0000AA, "Multiple users found, please narrow earch");
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "No matching user found");
}
}
userid = INVALID_PLAYER_ID;
}
return userid; // INVALID_USER_ID for bad return
}
IsNumeric(const string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}
stock GetDistanceBetweenPlayers(playerid,playerid2)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
new Float:dis;
GetPlayerPos(playerid,x1,y1,z1);
GetPlayerPos(playerid2,x2,y2,z2);
dis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs (floatsub(z2,z1)),2));
return floatround(dis);
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128],tmp[128];
new idx,idjogador;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/testegod", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xF97804FF, "[USO CORRETO]: /testegod [playerid/Nick]");
return 1;
}
idjogador = ReturnUser(tmp);
if(GetDistanceBetweenPlayers(playerid,strval(tmp)) > 25)
{
SendClientMessage(playerid, 0xF97804FF,"Vocк presisa estar perto para testar este jogador!");
}
if(strval(tmp) == playerid)//modifique se for de teu gosto
{
SendClientMessage(playerid, 0xF97804FF, "Vocк nгo pode usar este comando em si mesmo!");
}
if(admtrampando[playerid] < 1 && PlayerInfo[playerid][pAdmin] != 1342)
{
if(!IsPlayerConnected(idjogador)) return SendClientMessage(playerid, 0xF97804FF, "Jogador nгo estб conectado!");
if(idjogador != INVALID_PLAYER_ID)
{
GetPlayerPos(idjogador, slx, sly, slz);
GetPlayerHealth(idjogador,vida);
SetPlayerHealth(idjogador, 100);
SetPlayerArmour(idjogador, 0);
SetPlayerPos(idjogador, 1133.0504,-2038.4034,69.0971);
CreateExplosion(1133.0504,-2038.4034,69.0971, 7, 1);
SetTimerEx("TestarGod",2000, false, "i", idjogador);
}
}
else
{
SendClientMessage(playerid, 0xF97804FF, "Apenas Administradores!");
}
}
return 1;
}
return 0;
}
forward TestarGod(idjogador);
public TestarGod(idjogador)
{
new Float:checkvida;
GetPlayerHealth(idjogador, checkvida);
if(checkvida > 99)
{
SendClientMessageToAll(0xF97804FF, "[REPROVADO] O Player nгo perdeu HP normalmente!");
}
else if(checkvida < 99)
{
SendClientMessageToAll(0x61DAE0FF, "[APROVADO] O Player perdeu HP normalmente!");
}
SetPlayerHealth(idjogador, vida);
SetPlayerPos(idjogador, slx, sly, slz);
return 1;
}