/accent?
#1

Need Help badley!
I want things like just /accent,
As like you can put anything like /accent lol,
Even though it's not RP,
Can Someone help Much Appretiated.
Reply
#2

Ahh, I don't know what you wan't it like (sscanf or strtok). I guess i'll make it in strtok.

pawn Код:
new AccentData[MAX_PLAYERS][30];

// This is put under OnPlayerText
new txt[155], name[24];
GetPlayerName(playerid, name, 24);
format(txt, 155, "%s says (%s accent): %s", name, AccentData[playerid], text);
// Under the format is the local message function. (ProxDetector, SendLocalMessage, etc..)

// This is put under OnPlayerCommandText
if(!strcmp("/accent", cmdtext, true)) {
  new index;
  new tmp[20] = strtok(cmdtext, index);
  if(!strlen(tmp)) return SendClientMessage(playerid, 0xFFFFFFF, "/accept <accent> (German, Spanish etc..)");
  strmid(PlayersAccent[playerid], tmp, 0, strlen(tmp), 255);
  return 1;
}
Reply
#3

So in the Accept Bit I have to put All the things I want to accept as a Accent?
Thanks By the way.
Reply
#4

D:\Users\Admin\Desktop\ser_0.3\ser 0.3\gamemodes\larp.pwn(24193) : warning 219: local variable "tmp" shadows a variable at a preceding level
D:\Users\Admin\Desktop\ser_0.3\ser 0.3\gamemodes\larp.pwn(24193) : error 008: must be a constant expression; assumed zero
D:\Users\Admin\Desktop\ser_0.3\ser 0.3\gamemodes\larp.pwn(24195) : error 017: undefined symbol "PlayersAccent"
D:\Users\Admin\Desktop\ser_0.3\ser 0.3\gamemodes\larp.pwn(24195) : warning 215: expression has no effect
D:\Users\Admin\Desktop\ser_0.3\ser 0.3\gamemodes\larp.pwn(24195) : error 001: expected token: ";", but found "]"
D:\Users\Admin\Desktop\ser_0.3\ser 0.3\gamemodes\larp.pwn(24195) : error 029: invalid expression, assumed zero
D:\Users\Admin\Desktop\ser_0.3\ser 0.3\gamemodes\larp.pwn(24195) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#5

Well I fixed the errors and this is pretty much how it looks now
Код:
#define FILTERSCRIPT

#include <a_samp>

new AccentData[MAX_PLAYERS][30];

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print(" Accent System by Neal Anthony Loaded ");
	return 1;
}

public OnFilterScriptExit()
{
    print(" Accent System by Neal Anthony Unloaded ");
	return 1;
}

stock strtok(const string[], &index,seperator=' ')
{
	new length = strlen(string);
	new offset = index;
	new result[128];
	while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}

	result[index - offset] = EOS;
	if ((index < length) && (string[index] == seperator))
	{
		index++;
	}
	return result;
}
public OnPlayerConnect(playerid)
{
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	new txt[155], name[24];
	GetPlayerName(playerid, name, 24);
	format(txt, 155, "%s says (%s accent): %s", name, AccentData[playerid], text);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	new idx;
	new tmp[128];
	tmp = strtok(cmdtext, idx);
	if(!strcmp("/accent", cmdtext, true))
		{
			if(!strlen(tmp)) return SendClientMessage(playerid, 0xFFFFFFF, "/accept <accent> (German, Spanish etc..)");
			strmid(AccentData[playerid], tmp, 0, strlen(tmp), 255);
		}
	return 1;
}

#endif
It doesn't work though, I'm using this as a Filterscript and if I use it none of my commands even work.
Help? I need /accent too!
Reply
#6

Dont bump a one year old topic.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)