All pastes #982310 Raw Edit

Stuff

public cpp v1 · immutable
·published 2008-04-12 13:24 UTC
rendered paste body
#include <a_samp>#define FILTERSCRIPT#if defined FILTERSCRIPTnew Line[MAX_PLAYERS];new OnOff[MAX_PLAYERS];public OnFilterScriptInit(){	print("----------------------");	print(" Radio line v1 loaded ");	print("----------------------");	return 1;}public OnFilterScriptExit(){	return 1;}#endifpublic OnPlayerCommandText(playerid, cmdtext[]){	new string[100];	new cmd[256], idx;	cmd = strtok(cmdtext, idx);	new tmp[256];	new id;		if(!strcmp("/r", cmd, true))	{		if(OnOff[playerid] == 1)		{			SendClientMessage(playerid, 0x2641FEAA, "Your radio is off");		}		else		{			for(new i = 0; i < MAX_PLAYERS; i++)			{				if(IsPlayerConnected(i))				{					if(Line[i] == Line[playerid])					{					    if(OnOff[i] == 0)					    {							new pname[26];							GetPlayerName(playerid, pname, sizeof(pname));							format(string, 256, "(radio %d) %s: %s", Line, pname, cmdtext[3]);							SendClientMessage(i, 0x2641FEAA, string);						}					}				}			}		}		return 1;	}		if (strcmp("/cl", cmd, true) == 0)	{		tmp = strtok(cmdtext, idx);		if(!strlen(tmp)) return SendClientMessage(playerid, 0x2641FEAA, "You didn't put in a line");		id = strval(tmp);				Line[playerid] = id;		format(string, 256, "Your radio line has been set to %d", id);		SendClientMessage(playerid, 0x2641FEAA, string);		return 1;	}		if (strcmp("/ron", cmdtext, true) == 0)	{		SendClientMessage(playerid, 0x2641FEAA, "You have turned your radio on");		OnOff[playerid] = 0;		return 1;	}	if (strcmp("/roff", cmdtext, true) == 0)	{		SendClientMessage(playerid, 0x2641FEAA, "You have turned your radio off");		OnOff[playerid] = 1;		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;}