06.06.2014, 10:34
i will learn you how to make alot of CMDS simple for new scripters.
First
Put #include <zcmd> into your includes
2nd;
Do it
3rd
Do it
its /pm to private message someone
another
[code]
#include <zcmd>
Add it first of all
This "3" mean admin lvl 3 if you set it to 0 any player can use it
add it too into this CMD
/sethealth and /setarmor for admins only !!
please REP+ Me
First
Put #include <zcmd> into your includes
Code:
#include <zcmd>
Do it
Code:
CMD:pm(playerid, params[]) {
Do it
Code:
new str[128], str2[128], id, adminstr[128]; if(sscanf(params,"ds[128]", id, str2)) return SendClientMessage(playerid, red,"USAGE: /pm [id] [message]"); if(IsPlayerConnected(id)) { if(id != playerid) { if(DND[id] == 0) { format(str, sizeof(str),"PM to [%d]%s: %s", id, PlayerName2(id), str2); SendClientMessage(playerid, yellow, str); format(str, sizeof(str),"PM from [%d]%s: %s", playerid, PlayerName2(playerid), str2); SendClientMessage(id, yellow, str); format(adminstr, sizeof(adminstr),"PM from %s[%d] to %s[%d]: %s", PlayerName2(playerid), playerid, PlayerName2(id), id, str2); PlayerPlaySound(id,1085,0.0,0.0,0.0); MessageTo4(grey, adminstr); LastPm[id] = playerid; } else return SendClientMessage(playerid, red,"That player is in do not disturb mode!"); } else return SendClientMessage(playerid, red,"You cannot PM yourself"); } else return SendClientMessage(playerid, red,"Player is not connected"); return 1;
another
[code]
#include <zcmd>
Code:
CMD:sethealth(playerid,params[]) {
Code:
if(PlayerInfo[playerid][Level] >= 3) {
add it too into this CMD
Code:
new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); if(isnull(tmp) || isnull(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /sethealth [playerid] [amount]"); if(strval(tmp2) < 0 || strval(tmp2) > 100 && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid, red, "ERROR: Invaild health amount"); new player1 = strval(tmp), health = strval(tmp2), string[128]; if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin"); if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) { CMDMessageToAdmins(playerid,"SETHEALTH"); format(string, sizeof(string), "You have set \"%s's\" health to '%d", pName(player1), health); SendClientMessage(playerid,blue,string); if(player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your health to '%d'", pName(playerid), health); SendClientMessage(player1,blue,string); } return SetPlayerHealth(player1, health); } else return SendClientMessage(playerid,red,"ERROR: Player is not connected"); } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); }
Code:
CMD:setarmour(playerid,params[]) { if(PlayerInfo[playerid][Level] >= 3) { new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); if(isnull(tmp) || isnull(tmp2) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setarmour [playerid] [amount]"); if(strval(tmp2) < 0 || strval(tmp2) > 100 && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid, red, "ERROR: Invaild health amount"); new player1 = strval(tmp), armour = strval(tmp2), string[128]; if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin"); if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) { CMDMessageToAdmins(playerid,"SETARMOUR"); format(string, sizeof(string), "You have set \"%s's\" armour to '%d", pName(player1), armour); SendClientMessage(playerid,blue,string); if(player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your armour to '%d'", pName(playerid), armour); SendClientMessage(player1,blue,string); } return SetPlayerArmour(player1, armour); } else return SendClientMessage(playerid,red,"ERROR: Player is not connected"); } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command"); }
please REP+ Me