Errors!!!
#1

This Are The Errors:

Код:
C:\Documents and Settings\Administrator\Desktop\Server\gamemodes\sproba.pwn(234) : error 017: undefined symbol "strtok"
C:\Documents and Settings\Administrator\Desktop\Server\gamemodes\sproba.pwn(234) : error 033: array must be indexed (variable "x_nr")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
And This Is The Line Where The Errors Are:

Код:
   	x_nr = strtok(cmdtext, idx);
and here is all OnPlayerCommand Text:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/skill", cmdtext, true, 10) == 0)
	{
	if(IsSpawned[playerid] == 0) {
	SendClientMessage(playerid, COLOR_WHITE, "You are dead. You cannot use this command");
	return 1;
	}
	if(canchooseskill[playerid] == 0) {
	SendClientMessage(playerid, COLOR_WHITE, "You cannot use this command now. Only certain teams can use this at time of spawn");
  return 1;
  }
    	new x_nr[256];
    	x_nr = strtok(cmdtext, idx); -----------------------------> ERROR LINE
    	if(!strlen(x_nr)) {
    	SendClientMessage(playerid, COLOR_WHITE,"Use: /skill 1-6 to select your chosen skill. Default skill (Rapist) Will be given if you dont choose");
    	TextDrawShowForPlayer(playerid,Text:Textdraw0);
    	TextDrawShowForPlayer(playerid,Text:Textdraw1);
    	TextDrawShowForPlayer(playerid,Text:Textdraw2);
    	TextDrawShowForPlayer(playerid,Text:Textdraw3);
    	
    	return 1;
    	
			}
			if(strcmp(x_nr,"1",true) == 0) // Weapon Dealivery
			{
			SendClientMessage(playerid, COLOR_WHITE,"Type /commands to see your Skill/Job Commands!");
		  SendClientMessage(playerid,COLOR_WHITE, "Weapon Delivery: Your Job Is To Sell Weapons To Other Players For Earn Money! Type /commands To See Your Commands!");
		  
		  GivePlayerWeapon(playerid,5,1);
   		GivePlayerWeapon(playerid,22,100);
    	GivePlayerWeapon(playerid,14,1);
    	gTeam[playerid] = TEAM_GUNDEL;
    	SetPlayerToTeamColour(playerid);
    	canchooseskill[playerid] =0;
    	TextDrawHideForPlayer(playerid,Text:Textdraw0);
    	TextDrawHideForPlayer(playerid,Text:Textdraw1);
    	TextDrawHideForPlayer(playerid,Text:Textdraw2);
    	TextDrawHideForPlayer(playerid,Text:Textdraw3);
    	return 1;
			}
			else
			{
			SendClientMessage(playerid,COLOR_WHITE, "USAGE: /skill 1-6 To Choose Your Skill!");
			return 1;
			}
			}
			return 0;
}
Try To Help Me Please!



Reply
#2

You're missing a strtok function (you can find it here) and you don't need 256 cells, use 128.
Reply
#3

Hehe I liked the part of "You can find it here"
https://sampwiki.blast.hk/wiki/Strtok
Reply
#4

yeah ty guys it work fine and it show a text draws too but

when i type /skill 1 - this should be arms dealer it say server unknown command can u help ? i can post more code if u want
Reply
#5

Quote:
Originally Posted by Geekzor
if(strcmp("/skill", cmdtext, true, 10) == 0)
{
..
/skill has 6 characters, not 10.
Reply
#6

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by Geekzor
if(strcmp("/skill", cmdtext, true, 10) == 0)
{
..
/skill has 6 characters, not 10.
I dont get it it has 6 characters not 10

I change my commands and I Leave the 10 (in your case) 0

and it compiles and works perfectly!
Reply
#7

Quote:
Originally Posted by Compton's Eazy E
I dont get it it has 6 characters not 10
/skill = /, s, k, i, l, l
1 = /
2 = s
3 = k
4 = i
5 = l
6 = l

6 is the length of /skill command.

Using_strcmp()
Quote:

if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
{
..

Reply
#8

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by Compton's Eazy E
I dont get it it has 6 characters not 10
/skill = /, s, k, i, l, l
1 = /
2 = s
3 = k
4 = i
5 = l
6 = l

6 is the length of /skill command.

Using_strcmp()
Quote:

if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me
{
..

Like this and the script still works

Код:
if(strcmp(cmd, "/help", true) == 0)//
	{
	  SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"Visit us at www.EazyRP.tk");
	  SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"Commands - /Commands");
	  SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"Retaketutorial - /Tutorial (not reccommended)");
	  SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"RP help - /rphelp ");
	  SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"FAQ - /faq ");
	  return 1;
	}
Reply
#9

Quote:
Originally Posted by Compton's Eazy E
Like this and the script still works
Of course it works, but you missed the point.
Reply
#10

Guys you are awsome it works for now YAYYY if i get any problem i will post i love u all
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)