Script - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Script (
/showthread.php?tid=274833)
Script -
NTS - 07.08.2011
Hi can you guys please change this heal command and armour command for zcmd instead of strcmp and to use sscanf:
Health command
Код:
//-------------------------------[sethp]----------------------------------------
if(strcmp(cmd, "/sethp", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] < 4) return DenyMessage(playerid, 4);
new tmp2[256];
tmp = strtok(cmdtext, idx);
new otherplayer = ReturnUser(tmp);
tmp2 = strtok(cmdtext, idx);
new hp = strval(tmp2);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "USAGE: /sethp [playerid] [ammount]");
if(!strlen(tmp2)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "USAGE: /sethp [playerid] [ammount]");
if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
SetPlayerHealth(otherplayer, hp);
return 1;
}
the armour command:
Код:
//------------------------------[setarmor]--------------------------------------
if(strcmp(cmd, "/setarmor", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] < 5) return DenyMessage(playerid, 5);
new tmp2[256];
tmp = strtok(cmdtext, idx);
new otherplayer = ReturnUser(tmp);
tmp2 = strtok(cmdtext, idx);
new hp = strval(tmp2);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "USAGE: /setarmor [playerid] [ammount]");
if(!strlen(tmp2)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "USAGE: /setarmor [playerid] [ammount]");
if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
SetPlayerArmour(otherplayer, hp);
return 1;
}
Thanks
Re: Script -
Mujib - 07.08.2011
pawn Код:
COMMAND:sethp(playerid, params[]){
new
toplayerid,
amount;
if(PlayerInfo[playerid][pAdmin] < 4) return DenyMessage(playerid, 4);
if(sscanf(params, "dd", toplayerid, amount)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "USAGE: /sethp [playerid] [ammount]");
if(!IsPlayerConnected(toplayerid)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "Error: Invalid player ID");
SetPlayerHealth(toplayerid, amount)
}
COMMAND:setarmour(playerid, params[]){
new
toplayerid,
amount;
if(PlayerInfo[playerid][pAdmin] < 5) return DenyMessage(playerid, 5);
if(sscanf(params, "dd", toplayerid, amount)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "USAGE: /sethp [playerid] [ammount]");
if(!IsPlayerConnected(toplayerid)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "Error: Invalid player ID");
SetPlayerArmour(toplayerid, amount)
}
Not tested, but it should do the job.