Jump to content

Cum sa scapam de flood la 99/99/9999999


Recommended Posts

Guest RinX
Posted

Am vazut multi playeri care se plang de bugul la data acela cu 99/99/99999999, am decis sa fac un tutorial cum sa scapi de ele, nu este cine stie ce, dar mi-am incerca norocul si vreau sa ii scap de noobi ce fac bugul, unor scripteri incepatori, ce nu au experienta  ;).

Dam un search folosind dd/mm/yyyy, apoi la  else if(RegistrationStep[playerid] == 2) schimbam tot ce este cu strval in strvalEx, ca sa nu va chinuiti cautand, copiati peste cod asta

else if(RegistrationStep[playerid] == 2)
	    {
	        new year, month,day;
			getdate(year, month, day);
	        new DateInfo[3][20];
			split(text, DateInfo, '/');
			if(year - strvalEx(DateInfo[2]) > 100 || strvalEx(DateInfo[2]) < 1 || strvalEx(DateInfo[2]) >= year)
			{
			    SendClientMessage(playerid, COLOR_LIGHTRED, "What is your Birthdate? (Use dd/mm/yyyy)");
			    return 0;
			}
			new check = year - strvalEx(DateInfo[2]);
			if(check == year)
			{
			    SendClientMessage(playerid, COLOR_LIGHTRED, "What is your Birthdate? (Use dd/mm/yyyy)");
			    return 0;
			}
			if(strvalEx(DateInfo[1]) > month)
			{
			    check -= 1;
			}
			else if(strvalEx(DateInfo[1]) == month && strvalEx(DateInfo[0]) > day)
			{
			    check -= 1;
			}
			PlayerInfo[playerid][pAge] = check;
			format(string, sizeof(string), "Ok, so you are %d year old.",PlayerInfo[playerid][pAge]);
			SendClientMessage(playerid, COLOR_YELLOW2, string);
			RegistrationStep[playerid] = 3;
			SendClientMessage(playerid, COLOR_LIGHTRED, "What is your Origin? (Type in: SF - te vei spawna in SF, LS - te vei spawna il LS)");
			return 0;
	    }
Apoi la sfarsitul scriptului adaugati
}
stock strvalEx( const string[] ) // fixing bug with > 50 letters.
{
	if( strlen( string ) >= 50 ) return 0; // It will just return 0 if the string is too long
	return strval(string);
}

Guest DeLeCe
Posted

C:\Documents and Settings\ADeNe\Desktop\samp02Xserver.win32\gamemodes\GameWorld.PWN(25527) : error 017: undefined symbol "strvalEx"

C:\Documents and Settings\ADeNe\Desktop\samp02Xserver.win32\gamemodes\GameWorld.PWN(25532) : error 017: undefined symbol "strvalEx"

C:\Documents and Settings\ADeNe\Desktop\samp02Xserver.win32\gamemodes\GameWorld.PWN(25538) : error 017: undefined symbol "strvalEx"

C:\Documents and Settings\ADeNe\Desktop\samp02Xserver.win32\gamemodes\GameWorld.PWN(25542) : error 017: undefined symbol "strvalEx"

Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

4 Errors.

Ce sa fac?

EDIT:

Am reusit... pusesem ceva gresit :) MS ;D

Guest RinX
Posted

Ai adaugat la sfarsit

}
stock strvalEx( const string[] ) // fixing bug with > 50 letters.
{
	if( strlen( string ) >= 50 ) return 0; // It will just return 0 if the string is too long
	return strval(string);
}

inainte sa compilezi ?

Guest DeLeCe
Posted

eu adaugasem dupa alea primele ... :) dar mi-am dat seama dupa ...si a mers

  • 3 weeks later...
Posted

Foarte bun tutorialul ,am auzit si eu multi care se plang de problema asta. Gj

[img width=222 height=100]http://www.speedtest.net/result/734520190.pn

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.