SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 17/07/2012, 06:46 PM   #1
ArmandoRamiraz
Big Clucker
 
ArmandoRamiraz's Avatar
 
Join Date: Dec 2011
Posts: 128
Reputation: 16
Default Can someone tell me whats wrong here? 4 Errors.

I have tired everything I know and I still cannot figure out why I get these error messages. Hopefully someone else knows and can explain it to me?? Thanks in advance.

Error Messages:
Code:
C:\Users\Owner\Desktop\NGRP\gamemodes\NGRP.pwn(1341) : error 029: invalid expression, assumed zero
C:\Users\Owner\Desktop\NGRP\gamemodes\NGRP.pwn(1341) : warning 215: expression has no effect
C:\Users\Owner\Desktop\NGRP\gamemodes\NGRP.pwn(1341) : error 001: expected token: ";", but found ")"
C:\Users\Owner\Desktop\NGRP\gamemodes\NGRP.pwn(1341) : error 029: invalid expression, assumed zero
C:\Users\Owner\Desktop\NGRP\gamemodes\NGRP.pwn(1341) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Code:
Code:
	
        new i = 0;
	while(i < sizeof(arrForbiddenNames)) if(strcmp(arrForbiddenNames[i++], GetPlayerNameExt(playerid), true) == 0) {
		SetPlayerName(playerid, "InvalidNick");
		SendClientMessage(playerid, COLOR_RED, "You have been kicked & logged for using a forbidden username.");
		Kick(playerid);
		return 0;

	}
	return 1;
}
ArmandoRamiraz is offline   Reply With Quote
Old 17/07/2012, 06:55 PM   #2
[KHK]Khalid
Gangsta
 
[KHK]Khalid's Avatar
 
Join Date: Jan 2012
Location: Alexandria, Egypt
Posts: 854
Reputation: 136
Default Re: Can someone tell me whats wrong here? 4 Errors.

pawn Code:
new i = 0;
while(i < sizeof(arrForbiddenNames))
{ // you forgot this
    if(strcmp(arrForbiddenNames[i++], GetPlayerNameExt(playerid), true) == 0)
    {
        SetPlayerName(playerid, "InvalidNick");
        SendClientMessage(playerid, COLOR_RED, "You have been kicked & logged for using a forbidden username.");
        Kick(playerid);
        return 0;
    }
    return 1;
}
[KHK]Khalid is offline   Reply With Quote
Old 17/07/2012, 07:02 PM   #3
ArmandoRamiraz
Big Clucker
 
ArmandoRamiraz's Avatar
 
Join Date: Dec 2011
Posts: 128
Reputation: 16
Default Re: Can someone tell me whats wrong here? 4 Errors.

Quote:
Originally Posted by HellSphinX View Post
pawn Code:
new i = 0;
while(i < sizeof(arrForbiddenNames))
{ // you forgot this
    if(strcmp(arrForbiddenNames[i++], GetPlayerNameExt(playerid), true) == 0)
    {
        SetPlayerName(playerid, "InvalidNick");
        SendClientMessage(playerid, COLOR_RED, "You have been kicked & logged for using a forbidden username.");
        Kick(playerid);
        return 0;
    }
    return 1;
}


I did that but I still get the same errors.
ArmandoRamiraz is offline   Reply With Quote
Old 17/07/2012, 07:11 PM   #4
[KHK]Khalid
Gangsta
 
[KHK]Khalid's Avatar
 
Join Date: Jan 2012
Location: Alexandria, Egypt
Posts: 854
Reputation: 136
Default Re: Can someone tell me whats wrong here? 4 Errors.

Weird I compiled the code and it didn't give me errors except undefined symbols COLOR_RED and GetPlayerNameExt because I don't have those.. Uhmm I defined arrForbiddenNames like this new arrForbiddenNames[100]; may you show how is yours defined?
[KHK]Khalid is offline   Reply With Quote
Old 17/07/2012, 07:16 PM   #5
ArmandoRamiraz
Big Clucker
 
ArmandoRamiraz's Avatar
 
Join Date: Dec 2011
Posts: 128
Reputation: 16
Default Re: Can someone tell me whats wrong here? 4 Errors.

Mine is defined like this: new arrForbiddenNames[][]
ArmandoRamiraz is offline   Reply With Quote
Old 17/07/2012, 07:25 PM   #6
[KHK]Khalid
Gangsta
 
[KHK]Khalid's Avatar
 
Join Date: Jan 2012
Location: Alexandria, Egypt
Posts: 854
Reputation: 136
Default Re: Can someone tell me whats wrong here? 4 Errors.

Still no errors.

Can you point me to the line 1341 ?


Edit:


Where are you placing this code?
[KHK]Khalid is offline   Reply With Quote
Old 17/07/2012, 07:30 PM   #7
ArmandoRamiraz
Big Clucker
 
ArmandoRamiraz's Avatar
 
Join Date: Dec 2011
Posts: 128
Reputation: 16
Default Re: Can someone tell me whats wrong here? 4 Errors.

Right under the new defines. Here is the whole code.

Code:
//forward strfind(const string[],const sub[],bool:ignorecase=false,pos=0);

stock InvalidNameCheck(playerid)
	{
	new arrForbiddenNames[][] = {
			"com1", "com2", "com3", "com4",
			"com5", "com6", "com7", "com8",
			"com9", "lpt4", "lpt5", "lpt6",
			"lpt7", "lpt8", "lpt9", "nul",
			"clock$", "aux", "prn", "con",
			"InvalidNick"
                };

	        new i = 0;
	        while(i < sizeof(arrForbiddenNames))
	        { // you forgot this
line 1342--------	if(strcmp(arrForbiddenNames[i++], GetPlayerNameExt(playerid), true) == 0);
                {
                SetPlayerName(playerid, "InvalidNick");
                SendClientMessage(playerid, COLOR_RED, "You have been kicked & logged for using a forbidden username.");
                Kick(playerid);
              return 0;
          }
    return 1;
}
ArmandoRamiraz is offline   Reply With Quote
Old 17/07/2012, 07:37 PM   #8
[KHK]Khalid
Gangsta
 
[KHK]Khalid's Avatar
 
Join Date: Jan 2012
Location: Alexandria, Egypt
Posts: 854
Reputation: 136
Default Re: Can someone tell me whats wrong here? 4 Errors.

You missed a brace and there was a semi-colon right after the if statement which I removed. Should work now as it did right here.

pawn Code:
stock InvalidNameCheck(playerid)
{
    new arrForbiddenNames[][] = {
            "com1", "com2", "com3", "com4",
            "com5", "com6", "com7", "com8",
            "com9", "lpt4", "lpt5", "lpt6",
            "lpt7", "lpt8", "lpt9", "nul",
            "clock$", "aux", "prn", "con",
            "InvalidNick"
     };

    new i = 0;
    while(i < sizeof(arrForbiddenNames))
    { // you forgot this
        if(strcmp(arrForbiddenNames[i++], GetPlayerNameExt(playerid), true) == 0) // removed a ;
        {
            SetPlayerName(playerid, "InvalidNick");
            SendClientMessage(playerid, COLOR_RED, "You have been kicked & logged for using a forbidden username.");
            Kick(playerid);
            return 0;
        }
    } // added
    return 1;
}
[KHK]Khalid is offline   Reply With Quote
Old 17/07/2012, 07:54 PM   #9
ArmandoRamiraz
Big Clucker
 
ArmandoRamiraz's Avatar
 
Join Date: Dec 2011
Posts: 128
Reputation: 16
Default Re: Can someone tell me whats wrong here? 4 Errors.

:/ still didnt work. I dont understand...I have tried everything lol
ArmandoRamiraz 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
Whats wrong with this one +rep RicaNiel Scripting Help 11 28/04/2012 04:08 PM
Whats Wrong With This? Littlehelper Scripting Help 14 16/02/2012 12:19 PM
whats wrong with this npc fs sherlock Scripting Help 0 30/08/2011 01:13 PM
Whats Wrong Is tHe Npc robert4049 Help Archive 5 12/01/2010 06:16 AM
Whats wrong with this?[7 warnings][3 errors][1 fatal error] Tigerbeast11 Help Archive 2 08/11/2009 02:32 PM


All times are GMT. The time now is 03:16 PM.


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