making a revive cmd
#1

anyone can help me in /revive command, i want it in dcmd or strcmp, thanks
Reply
#2

What is it for? Roleplay? Do you currently have a death system implemented?
Reply
#3

http://forum.sa-mp.com/announcement.php?f=12
Reply
#4

its roleplay server, if a player dies, the admin can revive the player, using /revive. anyone can make it?
Reply
#5

Very easy to do that you just need to use SetPlayerHealth
Btw , here is the codes

Strcmp
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/heal", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 100.0);
        return 1;
    }
    return 0;
}
dcmd
pawn Код:
dcmd_heal(playerid, params[])
{
    SetPlayerHealth(playerid,100);
    return 1;
}
PS: sorry i didn't got you , when the player die he will automatically respawned , so could you explain please what are you trying to do ?
Reply
#6

ok, its a roleplay server and if someone dm or kill you, a admin can revive you using /revive, unfortunately i don't have that command. can someone make it? using dcmd or strcmp
Reply
#7

Quote:
Originally Posted by Jes
Посмотреть сообщение
ok, its a roleplay server and if someone dm or kill you, a admin can revive you using /revive, unfortunately i don't have that command. can someone make it? using dcmd or strcmp
If someone killed you , you can't heal him again because he will automatically re-spawned again , so i think you can't create a command to heal the player while his health equal too 0.

You can create something like ( create a variable to check if the player inside dm , and if his health equals too 1 freeze him from playing and admin can heal him or not ).
Reply
#8

Quote:
Originally Posted by Jes
Посмотреть сообщение
ok, its a roleplay server and if someone dm or kill you, a admin can revive you using /revive, unfortunately i don't have that command. can someone make it? using dcmd or strcmp
nope
Reply
#9

Can someone make this cmd in dcmd or strcmp command? thanks

Quote:

CMD:revive(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 3)
{
new string[128], giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /revive [playerid]");

if(IsPlayerConnected(giveplayerid))
{
if(GetPVarInt(giveplayerid, "Injured") == 1)
{
format(string, sizeof(string), " You have revived %s.", GetPlayerNameEx(giveplayerid));
SendClientMessageEx(playerid, COLOR_WHITE, string);
SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have been revived by an Admin.");

KillEMSQueue(giveplayerid);
ClearAnimations(giveplayerid);
SetPlayerHealth(giveplayerid, 100);
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD2, "That player is not injured!");
}
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}

Reply
#10

ahhh i can Understand you mean like : /forcespawn?
if yes :
Quote:

dcmd_spawn(playerid,params[])
{
if(AccInfo[playerid][Level] >= 2)
{
if(!strlen(params)) return

then lets make the error messsages
Quote:

SendClientMessage(playerid, LIGHTBLUE2, "Usage: /spawn [PlayerID]") &&
SendClientMessage(playerid, orange, "Function: Will Spawn a specified player");
new player1 = strval(params);
new string[128];
if(AccInfo[player1][Level] == ServerInfo[MaxAdminLevel] && AccInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
{
SendCommandToAdmins(playerid,"An admin Used /spawn");
format(string, sizeof(string), "|- You have Spawned \"%s\" -|", pName(player1));
SendClientMessage(playerid,BlueMsg,string);
if(player1 != playerid)
{
format(string,sizeof(string),"|- Administrator \"%s\" has Spawned you -|", pName(playerid));
SendClientMessage(player1,blue,string);
}
SetPlayerPos(player1, 0.0, 0.0, 0.0);
return SpawnPlayer(player1);
}
else return ErrorMessages(playerid, 2);
}
else return ErrorMessages(playerid, 1);
}

and done
(all cmd)
Quote:

dcmd_spawn(playerid,params[])
{
if(AccInfo[playerid][Level] >= 2)
{
if(!strlen(params)) return
SendClientMessage(playerid, LIGHTBLUE2, "Usage: /spawn [PlayerID]") &&
SendClientMessage(playerid, orange, "Function: Will Spawn a specified player");
new player1 = strval(params);
new string[128];
if(AccInfo[player1][Level] == ServerInfo[MaxAdminLevel] && AccInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
{
SendCommandToAdmins(playerid,"An admin Used /spawn");
format(string, sizeof(string), "|- You have Spawned \"%s\" -|", pName(player1));
SendClientMessage(playerid,BlueMsg,string);
if(player1 != playerid)
{
format(string,sizeof(string),"|- Administrator \"%s\" has Spawned you -|", pName(playerid));
SendClientMessage(player1,blue,string);
}
SetPlayerPos(player1, 0.0, 0.0, 0.0);
return SpawnPlayer(player1);
}
else return ErrorMessages(playerid, 2);
}
else return ErrorMessages(playerid, 1);
}

am i right?
Reply
#11

Quote:
Originally Posted by Jes
Посмотреть сообщение
Can someone make this cmd in dcmd or strcmp command? thanks
That's easy but i think you'll get a tons of errors because maybe you are using another admin variable and enums, btw try maybe it work , also dcmd is too old and outdated you can move to ZCMD or YCMDS which are most faster command processors
pawn Код:
dcmd_revive(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
    {
    new string[128], giveplayerid;
    if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /revive [playerid]");

    if(IsPlayerConnected(giveplayerid))
    {
    if(GetPVarInt(giveplayerid, "Injured") == 1)
    {
    format(string, sizeof(string), " You have revived %s.", GetPlayerNameEx(giveplayerid));
    SendClientMessageEx(playerid, COLOR_WHITE, string);
    SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have been revived by an Admin.");

    KillEMSQueue(giveplayerid);
    ClearAnimations(giveplayerid);
    SetPlayerHealth(giveplayerid, 100);
    }
    else
    {
    SendClientMessageEx(playerid, COLOR_GRAD2, "That player is not injured!");
    }
    }
    }
    else
    {
    SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
    }
    return 1;
}
Reply
#12

Can you make it using if(strcmp(cmd, "/revive", true) == 0) command?
Reply
#13

Quote:
Originally Posted by SilentSoul
View Post
That's easy but i think you'll get a tons of errors because maybe you are using another admin variable and enums, btw try maybe it work , also dcmd is too old and outdated you can move to ZCMD or YCMDS which are most faster command processors
pawn Code:
dcmd_revive(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
    {
    new string[128], giveplayerid;
    if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /revive [playerid]");

    if(IsPlayerConnected(giveplayerid))
    {
    if(GetPVarInt(giveplayerid, "Injured") == 1)
    {
    format(string, sizeof(string), " You have revived %s.", GetPlayerNameEx(giveplayerid));
    SendClientMessageEx(playerid, COLOR_WHITE, string);
    SendClientMessageEx(giveplayerid, COLOR_WHITE, "You have been revived by an Admin.");

    KillEMSQueue(giveplayerid);
    ClearAnimations(giveplayerid);
    SetPlayerHealth(giveplayerid, 100);
    }
    else
    {
    SendClientMessageEx(playerid, COLOR_GRAD2, "That player is not injured!");
    }
    }
    }
    else
    {
    SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
    }
    return 1;
}
got error
Reply
#14

Quote:
Originally Posted by Jes
View Post
got error
I know that you will get them because you copied from another gamemode, btw this command ain't heal the dead players this only checks if the player injured by an variable , if he is injured you can heal him , would you mind if you post the errors you got when you compile?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)