OMG? Why does this script not work?
#1

Код:
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?
Reply
#2

http://ampaste.net/m277c6c66
Reply
#3

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

Nope, it's a custom function
Reply
#5

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);
Reply
#6

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

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

Put it in a string then use in a message.

https://sampwiki.blast.hk/wiki/Format
Reply
#9

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)