All pastes #916141 Raw Edit

little bot admin FS (sa-mp 0.2.5

public cpp v1 · immutable
#916141 ·published 2008-02-24 11:26 UTC
rendered paste body
#include <a_samp>#define COLOR_RED 0xFF0000FF#define COLOR_GREEN 0x008000FF#define COLOR_YELLOW 0xFFFF00FF#define COLOR_GREY 0xAFAFAFAApublic OnFilterScriptInit(){	print("\n--------------------------------------");	print(" Blank Filterscript by your name here");	print("--------------------------------------\n");	return 1;}public OnFilterScriptExit(){	return 1;}public OnPlayerCommandText(playerid, cmdtext[]){    new cmd[256];	new idx;	cmd = strtok (cmdtext, idx);	new Float:X, Float:Y, Float:Z;	/* Command /goto */	if	(!strcmp(cmd, "/goto", true))	{		new pid, tmpp[256];		tmpp = strtok(cmdtext, idx);		if	(!strlen(tmpp))		{			SendClientMessage(playerid, COLOR_GREEN, "USAGE: /goto [actor id]");			return 1;		}		pid = strval(tmpp);		if 	(!(IsActorConnected(pid)))		{			SendClientMessage(playerid, COLOR_RED, "THAT ACTOR DOESN'T EXIST !");			return 1;		}		GetActorPos(pid,X,Y,Z);		new car = GetPlayerVehicleID(playerid);		new State=GetPlayerState(playerid);		new Interior = GetActorInterior(pid);		SetPlayerInterior(playerid,Interior);		if(State!=PLAYER_STATE_DRIVER)		{			SetPlayerPos(playerid,X+3,Y,Z);			SetPlayerInterior(playerid,Interior);		}		else if(IsPlayerInVehicle(playerid, car) == 1)		{			SetVehiclePos(car,X+3,Y,Z);			SetPlayerInterior(playerid,Interior);		}		else		{			SetPlayerPos(playerid,X+3,Y,Z);			SetPlayerInterior(playerid,Interior);		}		return 1;	}	/*Command /getthere */	else if	(!strcmp(cmd, "/gethere", true))	{		new pid, tmpp[256];		tmpp = strtok(cmdtext, idx);		if	(!strlen(tmpp))		{			SendClientMessage(playerid, COLOR_GREEN, "USAGE: /gethere [actor id]");			return 1;		}		pid = strval(tmpp);		if 	(!(IsActorConnected(pid)))		{			SendClientMessage(playerid, COLOR_RED, "THAT ACTOR DOESN'T EXIST !");			return 1;		}		GetPlayerPos(playerid,X,Y,Z);		new car = GetPlayerVehicleID(playerid);		new State=GetPlayerState(playerid);		new Interior = GetPlayerInterior(playerid);		if(State!=PLAYER_STATE_DRIVER)		{			RemoveActorFromVehicle(pid);			SetActorPos(pid,X+2,Y,Z);			SetActorInterior(pid,Interior);		}		else if(IsActorInVehicle(pid, car) == 1)		{			RemoveActorFromVehicle(pid);			SetActorPos(pid,X+2,Y,Z);			SetPlayerInterior(playerid,Interior);		}		else		{			SetActorPos(pid,X+2,Y,Z);			SetActorInterior(pid,Interior);		}		return 1;	}	/* Command /akill */	else if	(!strcmp(cmd, "/akill", true))	{		new pid, tmpp[256];		tmpp = strtok(cmdtext, idx);		if	(!strlen(tmpp))		{			SendClientMessage(playerid, COLOR_GREEN, "USAGE: /akill [actor id]");			return 1;		}		pid = strval(tmpp);		if 	(!(IsActorConnected(pid)))		{			SendClientMessage(playerid, COLOR_RED, "THAT ACTOR DOESN'T EXIST !");			return 1;		}		SetActorHealth(pid,-9999);		return 1;	}	/* Command /setname */  	else if	(!strcmp(cmd, "/setname", true))	{		new pid, tmp[256], tmpp[256];		tmpp = strtok(cmdtext, idx);		if	(!strlen(tmpp))		{			SendClientMessage(playerid, COLOR_GREEN, "USAGE: /setname [actor id] [new nick]");			return 1;		}		pid = strval(tmpp);		if 	(!(IsActorConnected(pid)))		{			SendClientMessage(playerid, COLOR_RED, "THAT ACTOR DOESN'T EXIST !");			return 1;		}		tmp = strtok(cmdtext, idx);		SetActorName(pid,tmp);	  	return 1;  	}  	/* Command /sethealth */	else if (!strcmp(cmd, "/sethealth", true))	{		new pid,id,tmp[256],tmpp[256];		tmp = strtok(cmdtext, idx);		tmpp = strtok(cmdtext, idx);		if	(!strlen(tmp))		{			SendClientMessage(playerid, COLOR_GREEN, "USAGE: /heal [actor id] [health]");			return 1;		}		pid = strval(tmp);		if 	(!(IsActorConnected(pid)))		{			SendClientMessage(playerid, COLOR_RED, "THAT ACTOR DOESN'T EXIST !");			return 1;		}		id = strval(tmpp);		SetActorHealth(pid,id);		return 1;	}	/* Command /setarmour */	else if	(!strcmp(cmd, "/setarmour", true))	{		new pid,id,tmp[256],tmpp[256];		tmp = strtok(cmdtext, idx);		tmpp = strtok(cmdtext, idx);		if	(!strlen(tmp))		{			SendClientMessage(playerid, COLOR_GREEN, "USAGE: /armour [actor id] [armour]");			return 1;		}		pid = strval(tmp);		if 	(!(IsActorConnected(pid)))		{			SendClientMessage(playerid, COLOR_RED, "THAT ACTOR DOESN'T EXIST !");			return 1;		}		id = strval(tmpp);		SetActorArmour(pid,id);		return 1;	}	/* Command /skin */	else if	(!strcmp(cmd, "/skin", true))	{	    new pid,id,tmp[256],tmpp[256];   		tmp = strtok(cmdtext, idx);		tmpp = strtok(cmdtext, idx);	    if (!strlen(tmp))	    {	        SendClientMessage(playerid, COLOR_GREEN, "USAGE: /skin [actor id] [skin id]");	        return 1;	    }   		pid = strval(tmp);		if 	(!(IsActorConnected(pid)))		{			SendClientMessage(playerid, COLOR_RED, "THAT ACTOR DOESN'T EXIST !");			return 1;		}		id = strval(tmpp);		if(id < 0 || id > 298 || id == 3 || id == 4 || id == 5 || id == 6 || id == 7 || id == 8 || id == 42 || id == 65 || id == 73 || id == 86 || id == 119 || id == 149 || id == 208 || id == 265 || id == 266 || id == 267 || id == 268 || id == 269 || id == 270 || id == 271 || id == 272 || id == 273 || id == 289)		{		    SendClientMessage(playerid,COLOR_RED,"[RAS]Invalid skin ID.");		    return 1;		}	    SetActorSkin(pid,id);	    return 1;	}	/* Command /giveweapon */	else if	(!strcmp(cmd, "/giveweapon", true))	{	    new pid,id1,tmp[256],tmpp[256];	    tmp = strtok(cmdtext, idx);	    tmpp = strtok(cmdtext, idx);	    if (!strlen(tmp))	    {	        SendClientMessage(playerid, COLOR_GREEN, "USAGE: /giveweapon [actor id] [weapon] [ammo]");	        return 1;	    }   		pid = strval(tmp);		if 	(!(IsActorConnected(pid)))		{			SendClientMessage(playerid, COLOR_RED, "THAT ACTOR DOESN'T EXIST !");			return 1;		}	    id1 = strval(tmpp);	    SetActorWeapon(pid,id1);	    return 1;	}	return 0;}strtok (const string[], &index){	new length = strlen(string);	while ((index < length) && (string[index] <= ' '))	{		index++;	}	new offset = index;	new result[20];	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))	{		result[index - offset] = string[index];		index++;	}	result[index - offset] = EOS;	return result;}