.::Strtok Problem::.
#1

All problems on this thread have been solved, do not bump it unless needed!


Okay, I am getting errors, and I have been trying to fix them, but I can't.

Here are the errors:
Код:
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(355) : warning 209: function "PnP_OnPlayerCommandText" should return a value
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(356) : warning 209: function "PnP_OnPlayerCommandText" should return a value
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(357) : warning 209: function "PnP_OnPlayerCommandText" should return a value
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(358) : warning 209: function "PnP_OnPlayerCommandText" should return a value
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(364) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(371) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(392) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(400) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(421) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(429) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(450) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(458) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(479) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(487) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(508) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(516) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(537) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(545) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(551) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(572) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(580) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(588) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(590) : error 078: function uses both "return" and "return <value>"
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(664) : error 047: array sizes do not match, or destination array is too small
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(667) : error 047: array sizes do not match, or destination array is too small
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(678) : warning 217: loose indentation
C:\Users\Matthew\samp02Xserver.win32\RPSERVER\gamemodes\SCRATCHIE-newLogin.pwn(679) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


21 Errors.
I've added it to a pastebin: Removed Since Fixed and contains my GM ^_^

If you want me to post it here, let me know.

Thanks for helping
Reply
#2

function uses both "return" and "return <value>"
Reply
#3

Quote:
Originally Posted by [SU
propilot ]
function uses both "return" and "return <value>"
But it doesnt!

Look:
Код:
if (strcmp("/help", cmdtext, true, 10) == 0)
	 {
	   SendClientMessage(playerid,COLOR_YELLOW,"Removed...");
	   return 1;
    }
Only 1 return
Reply
#4

Your dcmd define returns nothing ?
Reply
#5

Quote:
Originally Posted by dice7
Your dcmd define returns nothing ?
What do you mean?
Reply
#6

Replace your dcmd define with this one
pawn Код:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Reply
#7

Quote:
Originally Posted by dice7
Replace your dcmd define with this one
pawn Код:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Oh thanks!

This fixed them all!

xD

Lulz, im just trying to learn dcmd now, seems interesting.

Now, the last thing is this:


Errors:
Код:
error 047: array sizes do not match, or destination array is too small
error 047: array sizes do not match, or destination array is too small
Error lines are bolded and underlined.
Code:
Quote:

cmd_password(playerid, params[])
{
if(gPlayerInfo[playerid][PLAYER_REGGED] != 1)
return SendClientMessage(playerid, COLOR_ORANGE, "ERROR: You must register first to do that! Use /register [password] to register and login.");
else if(gPlayerInfo[playerid][PLAYER_LOGGED] == 0)
return SendClientMessage(playerid, COLOR_ORANGE, "ERROR: You must be logged-in to do that! Use /login [password] to login.");
else
{
new tmp[30],
tmp2[30],
index;
tmp = strtok(params, index);
if(!strlen(tmp))
return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /password [password] [new password]");
tmp2 = strtok(params, index);
if(!strlen(tmp2))
return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /password [password] [new password]");
new oldpassword = num_hash(tmp), newpassword = num_hash(tmp2);
if(gPlayerInfo[playerid][PLAYER_PASS] == oldpassword)
{
if(oldpassword == newpassword)
return SendClientMessage(playerid, COLOR_ORANGE, "ERROR: Your old password can not be the same as your new password.");
else if(strlen(params) < gSettings[PASS_MIN] || strlen(params) > gSettings[PASS_MAX])
{
new string[200];
format(string, sizeof(string), "ERROR: Password must be between %d and $d characters long!", gSettings[PASS_MIN], gSettings[PASS_MAX]);
return SendClientMessage(playerid, COLOR_ORANGE, string);
}
gPlayerInfo[playerid][PLAYER_PASS] = newpassword;
new string[256]; format(string, sizeof(string), "You have successfully changed your password from \'%s\' to \'%s\'.", tmp, tmp2);
return SendClientMessage(playerid, COLOR_BLUE, string);
}
else
return SendClientMessage(playerid, COLOR_ORANGE, "ERROR: Incorrect password.");
}
}

Reply
#8

Try
pawn Код:
new tmp[128]
Reply
#9

Changed the lines above it to:

pawn Код:
new tmp[128],
tmp2[128],
But, didn't work, same errors.

P.S. If you need more parts of the code, let me know.

NVM, set it to 500 and it works now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)