SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 12/06/2017, 04:08 AM   #1
Sublime
High-roller
 
Sublime's Avatar
 
Join Date: Jul 2013
Location: 6ix god
Posts: 997
Reputation: 223
Default Pawn compiler crashes, if/else if statement

Code:
	
new name[24], string[2];

GetPlayerName(playerid, name, sizeof(name));
if(sscanf(name, "{p<_>s[12]s[12]}") != 0)
{
	SendClientMessage(playerid, 0xFFFFFFFF, "* Invalid roleplay username, kicked.");
	DelayedKick(playerid);
}
else if
{
	for(new i = 0; i < 10; i ++)
	{
		format(string, sizeof(string), "%d", i);
		if(strfind(name, string, true) != -1)
		{
			SendClientMessage(playerid, 0xFFFFFFFF, "* Invalid roleplay username, kicked.");
			DelayedKick(playerid);
		}
	}
}
else
{
	//code...
}
Coming back to Pawn, working on a sample script. What that snippet does it to check a connecting user's username, and see if it follows the Firstname_Lastname format. If I compile that script, the compiler crashes after 10 seconds +/-. Not sure what the issue is, any help would be appreciated at this point.
__________________
Quote:
Originally Posted by Zorono View Post
Becuase its the best mod of GTA SA
and itsn't dead, Kalcor is having some proplems on his real life so he is busy now and release the new version now so shut your fucking mouse !!!!!!!!
Sublime is offline   Reply With Quote
Old 12/06/2017, 05:22 AM   #2
SoFahim
Gangsta
 
SoFahim's Avatar
 
Join Date: May 2015
Location: Bangladesh.
Posts: 868
Reputation: 86
Default Re: Pawn compiler crashes, if/else if statement

Code:
format(string, sizeof(string), "%d", i);
You are detecting name, why number comes here in the string? It is telling the script, find the number in the name, if no number found, kick him.
[hr][/hr]
Code:
if(sscanf(name, "{p<_>s[12]s[12]}") != 0)
Try using something else?
Code:
if( sscanf( name, "p<_>s[12]s[12]" ))
__________________
Ex Lead Developer & Mapping manager of SARP
(R.I.P SARP)
You can contact me at Discord, my ID: Gold#8839 available for paid works
Quote:
SoFahim is offline   Reply With Quote
Old 12/06/2017, 07:10 AM   #3
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,079
Reputation: 2655
Default Re: Pawn compiler crashes, if/else if statement

Else if ... what? If what? There should be a condition there.
__________________
Vince is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using tagof in switch statement crashes compiler Scottas Scripting Help 1 22/08/2013 12:43 PM
Pawn Compiler Crashes Jason_Thunde Scripting Help 4 16/10/2011 03:20 PM
Pawn Compiler Crashes =[ Ben7544 Help Archive 2 24/03/2011 05:53 PM


All times are GMT. The time now is 12:44 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.