12.12.2013, 17:52
anyone can help me in /revive command, i want it in dcmd or strcmp, thanks
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/heal", cmdtext, true, 10) == 0)
{
SetPlayerHealth(playerid, 100.0);
return 1;
}
return 0;
}
dcmd_heal(playerid, params[])
{
SetPlayerHealth(playerid,100);
return 1;
}
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
|
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; } |
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); } |
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); } |
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;
}
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:
|