change pass command errors (tmp) - 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: change pass command errors (tmp) (
/showthread.php?tid=146683)
change pass command errors (tmp) -
pmk1 - 08.05.2010
hey guys, i was looking on wiki samp for a change pass command n i found it. Everything is alright i just get 2 errors. But i don't know how to fix em. kind of frustrating xD
errors:
Код:
C:\Program Files (x86)\Rockstar games\Gta San Andreas\dedicated server\gamemodes\PMKadminscript.pwn(192) : error 047: array sizes do not match, or destination array is too small
C:\Program Files (x86)\Rockstar games\Gta San Andreas\dedicated server\gamemodes\PMKadminscript.pwn(195) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
code:
Код:
dcmd_password(playerid, params[])
{
if(gPlayerInfo[playerid][PLAYER_REGGED] != 1)
return SendClientMessage(playerid, COLOUR_ORANGE, "Before Changing Password, Create An Account! /Register [password]");
else if(gPlayerInfo[playerid][PLAYER_LOGGED] == 0)
return SendClientMessage(playerid, COLOUR_ORANGE, "You Forgot To Login Before Changing Password! /Login [password]");
else
{
new tmp[30],
tmp2[30],
index;
tmp = strtok(params, index);
if(!strlen(tmp))
return SendClientMessage(playerid, COLOUR_ORANGE, "USAGE: /password [password] [new password]");
tmp2 = strtok(params, index);
if(!strlen(tmp2))
return SendClientMessage(playerid, COLOUR_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, COLOUR_ORANGE, "ERROR: Your old password can not be the same as your new password.");
//else if(strlen(tmp2) < gSettings[PASS_MIN] || strlen(tmp2) > gSettings[PASS_MAX])
//{
//new string[100]; format(string, sizeof(string), "ERROR: Your new password must be between %d and %d characters long!", gSettings[PASS_MIN], gSettings[PASS_MAX]);
//return SendClientMessage(playerid, COLOUR_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, COLOUR_LIGHTBLUE, string);
}
else
return SendClientMessage(playerid, COLOUR_ORANGE, "ERROR: Incorrect password.");
}
}
lines with errors:
192: tmp = strtok(params, index);
195: tmp2 = strtok(params, index);
what is wrong? thanks for help
Re: change pass command errors (tmp) -
Jefff - 08.05.2010
Your strtok have array with 256 and U have tmp[30] must be tmp[256] or use format
Код:
tmp = strtok(params, index);
to
Код:
format(tmp,30,"%s",strtok(params, index));
and
Код:
tmp2 = strtok(params, index);
to
Код:
format(tmp2,30,"%s",strtok(params, index));
Re: change pass command errors (tmp) -
pmk1 - 08.05.2010
alright it's fixed

thanks man!