Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define NARANJA 0xF97804FF
- new Float:GODX;
- new Float:GODY;
- new Float:GODZ;
- new Float:ComandoGod;
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[128];
- new idx;
- if(strcmp(cmd, "/god", true) == 0)
- {
- new tmp[20];
- tmp = comandos(cmdtext, idx);
- if(GetDistanceBetweenPlayers(playerid,strval(tmp))>20)
- {
- return SendClientMessage(playerid,NARANJA,"[INCORRECT]: Jugador Longe Demas");
- }
- if(GetPlayerInterior(strval(tmp)>0))
- {
- return SendClientMessage(playerid,NARANJA,"[INCORRECT]: Jugador en Interior");
- }
- if(!IsPlayerConnected(strval(tmp))) return SendClientMessage(playerid, NARANJA, "[INCORRECT]: El Jugador si encontra OFF-LINE");
- if(strval(tmp) == playerid) return SendClientMessage(playerid, NARANJA, "[INCORRECT]: No Pode Reportar a Ti");
- if(strlen(tmp) == 0) return SendClientMessage(playerid, NARANJA, "Uso del Comando: /god [ID]");
- GetPlayerHealth(strval(tmp),ComandoGod);
- SetPlayerHealth(strval(tmp),80);
- GetPlayerPos(strval(tmp), GODX, GODY, GODZ);
- SetPlayerPos(strval(tmp), GODX, GODY, GODZ+20);
- SetTimerEx("CheckGod",2000,false,"ii",playerid,strval(tmp));//No Altere Tiempo
- SendClientMessage(playerid,NARANJA, "[INFO]: Para llevar a cabo con éxito congelaremos durante 2 segundos");
- TogglePlayerControllable(playerid,0);
- return 1;
- }
- return 0;
- }
- 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);
- }
- comandos(const string[], &index)//strtok Mudada
- {
- 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;
- }
- forward CheckGod(health1,playerid);
- public CheckGod(health1,playerid)
- {
- new string[62+MAX_PLAYER_NAME+MAX_PLAYER_NAME];
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- if(z != GODZ) return 0;
- new Float:health;
- GetPlayerHealth(playerid,health);
- if(health >= 80)
- {
- new name2[MAX_PLAYER_NAME];
- GetPlayerName(health1, name2, sizeof(name2));
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- format(string, sizeof(string),"-AntiGod-: %s ha banned for GodMod (By: %s [/god])",name,name2);
- SendClientMessageToAll(NARANJA, string);
- Ban(playerid);
- }
- SetPlayerHealth(playerid,ComandoGod);
- TogglePlayerControllable(health1,1);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement