All pastes #1008223 Raw Edit

Some dcmds

public text v1 · immutable
#1008223 ·published 2008-05-05 15:03 UTC
rendered paste body
public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd(kick,4,cmdtext);
	dcmd(levelme,7,cmdtext);
	dcmd(say,3,cmdtext);
	dcmd(givemoney,9,cmdtext);
	dcmd(setlevel,8,cmdtext);
	dcmd(giveallmoney,12,cmdtext);
	dcmd(akill,5,cmdtext);
	dcmd(explode,7,cmdtext);
	return 0;
}

dcmd_explode(playerid,params[])
{
	static Float:x;
    static Float:y;
    static Float:z;
    
	if(Level[playerid] >= 1){
	    if(strlen(params))
		{
	        	new id;id=strval(params);

			   	if(IsPlayerConnected(id))
				{
				    GetPlayerPos(id,x,y,z);CreateExplosion(x,y,z,6,5.0);
	        
					new aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME],str[128];GetPlayerName(playerid,aname,sizeof(aname)); GetPlayerName(id,name,sizeof(name));
					format(str,sizeof(str),"%s was exploded by Administrator %s.",name,aname);SCMTA(COLOR_YELLOW,str);
					print(str);
					return 1;

				}else{return SCM(playerid,COLOR_RED,"ERROR: Player not connected.");}
		}else{return SCM(playerid,COLOR_RED,"SYNTAX: /explode <playerid>");}
	}else{return SCM(playerid,COLOR_RED,"ERROR: You are not a high enough level to do this!");}
}
dcmd_akill(playerid,params[])
{if(Level[playerid] >= 2){
	    if(strlen(params)){
			new id;id=strval(params);
  			if(IsPlayerConnected(id))
			{
				SetPlayerHealth(id,0.0);new aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME],str[128];GetPlayerName(playerid,aname,sizeof(aname)); GetPlayerName(id,name,sizeof(name));
				format(str,sizeof(str),"%s was auto-killed by Administrator %s.",name,aname);SCMTA(COLOR_YELLOW,str);print(str);return 1;
			}else{return SCM(playerid,COLOR_RED,"ERROR: Player not connected.");
	  	}
		}else{return SCM(playerid,COLOR_RED,"SYNTAX: /akill <playerid>");
		}
	}else{return SCM(playerid,COLOR_RED,"ERROR: You are not a high enough level to do this!");
	}
}
	
dcmd_giveallmoney(playerid,params[])
{
	if(Level[playerid] >= 4){
		if(strlen(params)){
			new id;id=strval(params);if(id <= 1000000000){
			    new name[MAX_PLAYER_NAME],str[128];	GetPlayerName(playerid,name,sizeof(name));
				format(str,sizeof(str),"Administrator %s has given you all $%d.",name,id);SCMTA(COLOR_YELLOW,str);print(str);
			    for(new i=0; i<MAX_PLAYERS; i++){GivePlayerMoney(i,id);}
			}else{return SCM(playerid,COLOR_RED,"ERROR: Ammount to high!");
			}
		}else{return SCM(playerid,COLOR_RED,"SYNTAX: /giveallmoney <ammount>");
		}
	}else{return SCM(playerid,COLOR_RED,"ERROR: You are not a high enough level to do that!");
	}return 1;
}

dcmd_setlevel(playerid,params[])
{
	if(Level[playerid] == 5){
	    if(strlen(params)){
	        new id;id = strval(params);new pos = chrfind(' ',params);new Tlevel = strval(params[pos]);
	        if (pos >= 0){
	            if(IsPlayerConnected(id)){
	            	if(Tlevel <= 5){
	    				Level[id] = Tlevel;new aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME],str[128];GetPlayerName(playerid,aname,sizeof(aname)); GetPlayerName(id,name,sizeof(name));
						format(str,128,"Administrator %s set %s's Administrator level to %d.",aname,name,Tlevel);
						SCMTA(COLOR_YELLOW,str);print(str);
						return 1;
					}else{return SCM(playerid,COLOR_RED,"ERROR: That ammount is over the Max level!");
					}
				}else{return SCM(playerid,COLOR_RED,"ERROR: Player not connected.");
				}
			}else{return SCM(playerid,COLOR_RED,"SYNTAX: /setlevel <playerid> <level>");
			}
		}else{return SCM(playerid,COLOR_RED,"SYNTAX: /setlevel <playerid> <level>");
		}
	}else{return SCM(playerid,COLOR_RED,"ERROR: You are not a high enough level to do that!");
	}
}
	                
dcmd_givemoney(playerid,params[])
{
	if(Level[playerid] >= 2){
	    if(strlen(params)) {
	        new id;new pos = chrfind(' ',params); id = strval(params);new sum = strval(params[pos]);
	        if (pos >= 0){
	            if(IsPlayerConnected(id)){
	                if(sum <= 1000000000){
	                	new aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME],str[128];GetPlayerName(playerid,aname,sizeof(aname)); GetPlayerName(id,name,sizeof(name));
						format(str,128,"Administrator %s gave %s $%d.",aname,name,sum);
						GivePlayerMoney(id,sum);SCMTA(COLOR_YELLOW,str);print(str);
						return 1;
					}else{return SCM(playerid,COLOR_RED,"ERROR: Ammount to high!");}
				}else{return SCM(playerid,COLOR_RED,"ERROR: Player not connected.");}
			}else{return SCM(playerid,COLOR_RED,"SYNTAX: /givemoney <playerid> <ammount>");}
		}else{return SCM(playerid,COLOR_RED,"SYNTAX: /givecmoney <playerid> <ammount>");}
	}else{return SCM(playerid,COLOR_RED,"ERROR: You are not a high enough level to do that!");}
}

dcmd_say(playerid,params[]){
	if(Level[playerid] >= 1){
		if(strlen(params)){
	    	new str[128],name[MAX_PLAYER_NAME];GetPlayerName(playerid,name,sizeof(name));format(str,128,"Admin %s: %s",name,params);return SCMTA(COLOR_MAGENTA,str);
		}else{return SCM(playerid,COLOR_RED,"SYNTAX: /say <text>");
		}
	}else{return SCM(playerid,COLOR_RED,"ERROR: You are not a high enough level to do that!");
	}
}

dcmd_kick(playerid,params[]){
	if(Level[playerid] >= 2){
		if(strlen(params))
		{
		    new id; id=strval(params);
   			if(IsPlayerConnected(id))
		   	{
		        new aname[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME],str[128],str2[128];
		        GetPlayerName(playerid,aname,sizeof(aname)); GetPlayerName(id,name,sizeof(name));
		      	format(str,128,"You have been kicked by Administrator: %s.",aname);	format(str2,128,"%s has been kicked by Administrator: %s.",name,aname);
				SCM(id,COLOR_YELLOW,str);Kick(id);SCMTA(COLOR_YELLOW,str2);

				print(str2);

				return 1;
			}else{return SCM(playerid,COLOR_RED,"ERROR: Player not connected");}
		}else{ return SCM(playerid,COLOR_RED,"SYNTAX: /kick <playerid> <reason>");}
	}else{return SCM(playerid,COLOR_RED,"ERROR: You are not a high enough level to do that!");}
}

dcmd_levelme(playerid,params[]){
	#pragma unused params
	if(IsPlayerAdmin(playerid)){
	    Level[playerid] = 5;SCM(playerid,COLOR_YELLOW,"SUCCESS: You have been promoted to the top level. (5)");	return 1;
	}else{return 0;}
}