SA-MP Forums Archive
OMG? Why does this script not work? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OMG? Why does this script not work? (/showthread.php?tid=70744)



OMG? Why does this script not work? - Remi-X - 27.03.2009

Код:
if (strcmp("/okill", cmdtext, true) == 0)
	{
	  if(adminlevel[playerid] > 1)
	  {
 		new killplayer;
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, GRAY, "Usage: /okill [id]");
			return 1;
		}
		killplayer = strval(tmp);
		
			if(!IsPlayerConnected(killplayer))
			{
				SendClientMessage(playerid, RED,"Player is not online!");
				return 1;
			}
			else
			{
				SendClientMessage(killplayer, RED,"You've been killed by %s! (ID %d)", name, playerid);
				SetPlayerHealth(killplayer, 0);
				format(string, sizeof(string), "%s (ID %d) Has used /okill onto %s.", name, playerid, killplayer);
				print(string);
				return 1;
			}
		else
		{
			SendClientMessage(playerid, GRAY, "You're not allowed to use this command.");
			format(string, sizeof(string), "%s (ID %d) Has used /okill unsuccesfully.", name, playerid, killplayer);
			print(string);
		}
	}
	return 1;
	)
If i add that in my GM, i get 26 errors:
3X
Код:
C:\Users\Remi de Groot\Desktop\SAMP Test Server\gamemodes\remi-x.pwn(287) : error 004: function "SendPlayerFormattedText" is not implemented
23X
Код:
C:\Users\Remi de Groot\Desktop\SAMP Test Server\gamemodes\remi-x.pwn(431) : error 079: inconsistent return types (array & non-array)
The errors are on different rules, not only at these.
and if i delete this script out of my GM, everithing works perfect.
Anybody who see the error?


Re: OMG? Why does this script not work? - LarzI - 27.03.2009

http://ampaste.net/m277c6c66


Re: OMG? Why does this script not work? - Ryhanna - 27.03.2009

First of all, killplayer should be:
killplayer = ReturnUser(tmp);



Re: OMG? Why does this script not work? - LarzI - 27.03.2009

Nope, it's a custom function


Re: OMG? Why does this script not work? - Remi-X - 27.03.2009

Quote:
Originally Posted by lrZ^
Ty, that works. But now 2 warnings:
Код:
C:\Users\Remi de Groot\Desktop\SAMP Test Server\gamemodes\remi-x.pwn(1171) : warning 202: number of arguments does not match definition
C:\Users\Remi de Groot\Desktop\SAMP Test Server\gamemodes\remi-x.pwn(1171) : warning 202: number of arguments does not match definition
On the rule:
Код:
SendClientMessage(killplayer, RED,"You've been killed by %s! (ID %d)", name, playerid);



Re: OMG? Why does this script not work? - LarzI - 27.03.2009

Oh, you need to format the messages (check the wiki for format)
Or you could get the function SendFormattedMessage or something like that


Re: OMG? Why does this script not work? - zanakinz - 27.03.2009

SendClientMessage(Playerid, COLOR_RED,"You've been killed by %s! (ID %d)");


Re: OMG? Why does this script not work? - SpiderPork - 27.03.2009

Put it in a string then use in a message.

https://sampwiki.blast.hk/wiki/Format


Re: OMG? Why does this script not work? - Remi-X - 27.03.2009

The code is already good since the last post of IrZ^. So everything is fine now


Re: OMG? Why does this script not work? - LarzI - 27.03.2009

I really need to update my name...
Everybody calls me IrZ :P
It's lrZ, like in larzi (which was my first nick) but without the vocals