Script
#1

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
Reply
#2

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


Forum Jump:


Users browsing this thread: 1 Guest(s)