Give God Take God
#1

Hello Samp Members.
I am Finding for a script /givegod [id] /takegod [id] for Admin Level 4 If someone can help me please do it
If you have please also give toggle goto mode FS
Thanks in advance
Reply
#2

What Give God, what do you mean? godmode?

What command processor are you using? ZCMD?
Reply
#3

I CMD Processor is DCMD
And i want a CMd like
/Givegod which will give god to player
and /takegod will remove it back again
Reply
#4

pawn Код:
new godmode[MAX_PLAYERS] = 0; // somewhere in ur script.
CMD:givegod(playerid,params[])
{
    new target;
    if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"/givegod [ID/Partofname]");
    if(godmode[target] == 0)
    {
        SetPlayerHealth(target,99999);
        SetPlayerArmor(target,99999);
        SendClientMessage(target,-1,"Godemode ON.");
        SendClientMessage(playerid,-1,"Player Godmode activated.");
    }
    else { SendClientMessage(playerid,-1,"Player's Godmode is already on."); }
}
CMD:takegod(playerid,params[])
{
    new target;
    if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"/takegod [ID/Partofname]");
    if(godmode[target] == 1)
    {
        SetPlayerHealth(target,100);
        SetPlayerArmor(target,0);
        SendClientMessage(target,-1,"Godemode OFF.");
        SendClientMessage(playerid,-1,"Player Godmode deactivated.");
    } else { SendClientMessage(playerid,-1,"Player Godmode is already off.");
}
Reply
#5

Hint: You can save health and armor before "giving" god mode and then set when you remove god you set previous health and armor
Also, you could set timer to refresh health, because you could be killed with 99999 health if enemy's got miniguns or rocket launchers
Reply
#6

Can u add admin level 5 ccan use this cmd bcoz i want it
Reply
#7

"We", don't know about your "Admin System"
if you want to, this use "Rcons" add "If(IsPlayerAdmin(playerid)) { }"
Reply
#8

this is what i use in my adm system so what now ?
Quote:

if(PlayerInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid)) {

Reply
#9

pawn Код:
new godmode[MAX_PLAYERS] = 0; // somewhere in ur script.
CMD:givegod(playerid,params[])
{
    if(PlayerInfo[playerid][Level] <= 5 || IsPlayerAdmin(playerid)) {
    new target;
    if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"/givegod [ID/Partofname]");
    if(godmode[target] == 0)
    {
        SetPlayerHealth(target,99999);
        SetPlayerArmor(target,99999);
        SendClientMessage(target,-1,"Godemode ON.");
        SendClientMessage(playerid,-1,"Player Godmode activated.");
    }
    else { SendClientMessage(playerid,-1,"Player's Godmode is already on."); }
    }
}
CMD:takegod(playerid,params[])
{
    if(PlayerInfo[playerid][Level] <= 5 || IsPlayerAdmin(playerid))
    {
    new target;
    if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"/takegod [ID/Partofname]");
    if(godmode[target] == 1)
    {
        SetPlayerHealth(target,100);
        SetPlayerArmor(target,0);
        SendClientMessage(target,-1,"Godemode OFF.");
        SendClientMessage(playerid,-1,"Player Godmode deactivated.");
    } else { SendClientMessage(playerid,-1,"Player Godmode is already off.");
    }
}
Reply
#10

What About toggle goto /gotooff /gotoon and /goto for players :P if its hard then np
BTW DCMD
Reply
#11

Thank yuh but i want DCMD :/
Reply
#12

Next time, please use SEARCH How to convert strcmp to ZCMD/DCMD or vice versa.
pawn Code:
new godmode[MAX_PLAYERS] = 0; // somewhere in ur script.
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    dcmd( givegod , 7, cmdtext); // Note that the characters in DCMD exclude the "/", so we use 4, instead of 5 we used in strcmp
    dcmd( takegod, 7, cmdtext);
    return 0;
}
dcmd_givegod(playerid,params[])
{
    if(PlayerInfo[playerid][Level] <= 5 || IsPlayerAdmin(playerid)) {
    new target;
    if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"/givegod [ID/Partofname]");
    if(godmode[target] == 0)
    {
        SetPlayerHealth(target,99999);
        SetPlayerArmor(target,99999);
        SendClientMessage(target,-1,"Godemode ON.");
        SendClientMessage(playerid,-1,"Player Godmode activated.");
    }
    else { SendClientMessage(playerid,-1,"Player's Godmode is already on."); }
    }
}
dcmd_takegod(playerid,params[])
{
    if(PlayerInfo[playerid][Level] <= 5 || IsPlayerAdmin(playerid))
    {
    new target;
    if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"/takegod [ID/Partofname]");
    if(godmode[target] == 1)
    {
        SetPlayerHealth(target,100);
        SetPlayerArmor(target,0);
        SendClientMessage(target,-1,"Godemode OFF.");
        SendClientMessage(playerid,-1,"Player Godmode deactivated.");
    } else { SendClientMessage(playerid,-1,"Player Godmode is already off.");
    }
}
Reply
#13

Thanks goto ? if u know please provide
Reply
#14

Not mine, but this is with explanation so you can learn from it
pawn Code:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    dcmd( goto , 4, cmdtext); // Note that the characters in DCMD exclude the "/", so we use 4, instead of 5 we used in strcmp
    return 0;
}
dcmd_goto(playerid, params[])
{
     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "You need to be RCON for use this command");
     new ID;
     new pn[MAX_PLAYER_NAME];
     new an[MAX_PLAYER_NAME];
     new str[128];
     if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /goto [ID]"); //This is a long line, "sscanf" is the plugin that search the missing params, "params" is the param that define params LOL, "u" is the PARAM that define the MISSING ID, ID is the param for the targetid
     if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: This player is not connected");//Same as !IsPlayerAdmin, but instead of "playerid" we put "ID" because it's the targetid
     GetPlayerName(playerid, an, MAX_PLAYER_NAME);//Define the playerid's param
     GetPlayerName(ID, pn, MAX_PLAYER_NAME);//Define the ID's param
     new Float:x; //Defining float X
     new Float:y; //Same
     new Float:z; //Same
     GetPlayerPos(ID, x, y, z); //This line get the "ID" position
     SetPlayerPos(playerid, x+1, y+1, z); //This line set the "playerid" position from "ID" position, with some changes(x+1, y+1);
     format(str, sizeof(str), "You have been teleported to %s", pn); //Showed before, this is the line that give the message to playerid)
     SendClientMessage(playerid, 0x00FF00AA, str); //This line give the message to playerid
     if(IsPlayerInAnyVehicle(playerid)) //Mhh, let's give you a question, what should this callback do?
     {
          GetPlayerPos(ID, x, y, z);
          SetVehiclePos(playerid, x+1, y+1, z); //And this one? :D
     }
     return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)