Please help me
#1

I get that error:
Код:
C:\Users\Sebastian\Desktop\SERVER\gamemodes\MovieMaker.pwn(799) : error 017: undefined symbol "tmp"
C:\Users\**\Desktop\SERVER\gamemodes\MovieMaker.pwn(799) : error 017: undefined symbol "strtok"
C:\Users\**\Desktop\SERVER\gamemodes\MovieMaker.pwn(800) : error 017: undefined symbol "tmp"
C:\Users\**\Desktop\SERVER\gamemodes\MovieMaker.pwn(801) : error 017: undefined symbol "tmp"
C:\Users\**\Desktop\SERVER\gamemodes\MovieMaker.pwn(802) : error 017: undefined symbol "gMessage"
C:\Users\Desktop\SERVER\gamemodes\MovieMaker.pwn(802) : error 017: undefined symbol "strrest"
C:\Users\\Desktop\SERVER\gamemodes\MovieMaker.pwn(803) : error 017: undefined symbol "gMessage"
C:\Users\\Desktop\SERVER\gamemodes\MovieMaker.pwn(805) : error 017: undefined symbol "iName"
C:\Users\\Desktop\SERVER\gamemodes\MovieMaker.pwn(805) : error 017: undefined symbol "iName"
C:\Users\\Desktop\SERVER\gamemodes\MovieMaker.pwn(805) : error 029: invalid expression, assumed zero

But code is:
Код:
if(!strcmp("/pm", cmdtext, true))
{
  tmp = strtok(cmdtext,idx);
  if(!strlen(tmp)) return SendClientMessage(playerid,0xFF0000FF,"USAGE: /PM (id) (message)");
  new id = strval(tmp);
  gMessage = strrest(cmdtext,idx);
  if(!strlen(gMessage)) return SendClientMessage(playerid,0xFF0000FF,"Usage: /pm (id) (message)");
  if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000FF,"/pm :Invalid ID");
  GetPlayerName(id,iName,sizeof(iName));
  GetPlayerName(playerid,pName,sizeof(pName));
  format(Message,sizeof(Message),">> %s(%i): %s",iName,id,gMessage);
  SendClientMessage(playerid,0xFFD720FF,Message);
  format(Message,sizeof(Message),"** %s(%i): %s",pName,playerid,gMessage);
  SendClientMessage(id,0xFFD720FF,Message);
  PlayerPlaySound(id,1085,0.0,0.0,0.0);
  return 1;
}

Reply
#2

you have no

"new"

add

new tmp[128];

just before your line that says tmp=strtok ......

for everything else that says undefined symbol add a line like above

new iName;
new gMessage[128];

next make sure you have the includes at the top:

#include <a_samp>
#include <core>
#include <float>

see if that fixes it
Reply
#3

Okay I did that but now errors:
Код:
C:\Users\Sebastian\Desktop\SERVER\gamemodes\MovieMaker.pwn(951) : error 017: undefined symbol "strtok"
C:\Users\\Desktop\SERVER\gamemodes\MovieMaker.pwn(951) : error 033: array must be indexed (variable "tmp")
C:\Users\\Desktop\SERVER\gamemodes\MovieMaker.pwn(954) : error 017: undefined symbol "strrest"
C:\Users\\Desktop\SERVER\gamemodes\MovieMaker.pwn(954) : error 033: array must be indexed (variable "gMessage")
C:\Users\\Desktop\SERVER\gamemodes\MovieMaker.pwn(957) : error 035: argument type mismatch (argument 2)
C:\Users\\Desktop\SERVER\gamemodes\MovieMaker.pwn(957) : error 035: argument type mismatch (argument 2)
C:\Users\\Desktop\SERVER\gamemodes\MovieMaker.pwn(958) : error 017: undefined symbol "pName"
C:\Users\\Desktop\SERVER\gamemodes\MovieMaker.pwn(958) : error 017: undefined symbol "pName"
C:\Users\\Desktop\SERVER\gamemodes\MovieMaker.pwn(958) : error 029: invalid expression, assumed zero
Reply
#4

Please help me
Reply
#5

Add strtok somewhere in your script (for example, at the bottom line)

Код:
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;
}
Also, add
Код:
new pName[MAX_PLAYER_NAME], iName[MAX_PLAYER_NAME];
So it'll be like this:

pawn Код:
if(!strcmp("/pm", cmdtext, true))
{
  new pName[MAX_PLAYER_NAME], iName[MAX_PLAYER_NAME], gMessage;
  tmp = strtok(cmdtext,idx);
  if(!strlen(tmp)) return SendClientMessage(playerid,0xFF0000FF,"USAGE: /PM (id) (message)");
  new id = strval(tmp);
  gMessage = strrest(cmdtext,idx);
  if(!strlen(gMessage)) return SendClientMessage(playerid,0xFF0000FF,"Usage: /pm (id) (message)");
  if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000FF,"/pm :Invalid ID");
  GetPlayerName(id,iName,sizeof(iName));
  GetPlayerName(playerid,pName,sizeof(pName));
  format(Message,sizeof(Message),">> %s(%i): %s",iName,id,gMessage);
  SendClientMessage(playerid,0xFFD720FF,Message);
  format(Message,sizeof(Message),"** %s(%i): %s",pName,playerid,gMessage);
  SendClientMessage(id,0xFFD720FF,Message);
  PlayerPlaySound(id,1085,0.0,0.0,0.0);
  return 1;
}
Untested, most likely with a few errors, but it's a start
Reply
#6

error 017: undefined symbol "strtok"
Reply
#7

Код:
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;
}
You added this somewhere ?
Reply
#8

yes and from this is showing this error
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)