SA-MP Forums Archive
making a revive cmd - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: making a revive cmd (/showthread.php?tid=480770)



making a revive cmd - Jes - 12.12.2013

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


Re: making a revive cmd - dannyk0ed - 12.12.2013

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


Re: making a revive cmd - doreto - 12.12.2013

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


Re: making a revive cmd - Jes - 12.12.2013

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


Re: making a revive cmd - SilentSoul - 12.12.2013

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 ?


Re: making a revive cmd - Jes - 12.12.2013

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


Re: making a revive cmd - SilentSoul - 12.12.2013

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 ).


Re: making a revive cmd - Ada32 - 12.12.2013

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


Re: making a revive cmd - Jes - 12.12.2013

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;
}




Re: making a revive cmd - Kells - 12.12.2013

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?


Re: making a revive cmd - SilentSoul - 12.12.2013

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;
}



Re: making a revive cmd - Jes - 13.12.2013

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


Re: making a revive cmd - Jes - 13.12.2013

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


Re: making a revive cmd - SilentSoul - 13.12.2013

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?