invalid function or declaration and unmatched closing brace ("}") errors.Help:S
#1

Hey guys ive started to script a little but i got some erors
Код:
if (strcmp("/buy micro SMG", cmdtext, true, 10) == 0)
		SendClientMessage(playerid,0xAA3333AA,"You have bought a Micro SMG.You lost 4000$");//
		GivePlayerWeapon(playerid, 28,200);
		GivePlayerMoney(playerid,-4000);
		return 1;

	}
	
	if (strcmp("/buy AK47", cmdtext, true, 10) == 0)
		SendClientMessage(playerid,0xAA3333AA,"You have bought an AK47.You lost 5000$");//
		GivePlayerWeapon(playerid, 30,200);
		GivePlayerMoney(playerid,-5000);
		return 1;

	}
	
	if (strcmp("/buy sniper rifle", cmdtext, true, 10) == 0)
		SendClientMessage(playerid,0xAA3333AA,"You have bought a Sniper Rifle.You lost 7000$");//
		GivePlayerWeapon(playerid, 34,25);
		GivePlayerMoney(playerid,-7000);
		return 1;

	}
	
	if (strcmp("/buy satchel charge", cmdtext, true, 10) == 0)
		SendClientMessage(playerid,0xAA3333AA,"You have bought a Sactchel Charge&Detonator.You lost 15000$");//
		GivePlayerWeapon(playerid, 39,5);
		GivePlayerMoney(playerid,-15000);
		return 1;

	}
	
	if (srcmp("/buy large white vibrator", cmdtext, true, 10) == 0)
		SendClientMessage(playerid,0xAA3333AA,"You have bought an Large White Vibrator.You lost 500$");//
		GivePlayerWeapon(playerid, 12,1);
		GivePlayerMoney(playerid,-500);
		return 0;

	return 1;
}
And the erors are:C:\Documents and Settings\Root\Desktop\seex.pwn(163) : error 010: invalid function or declaration
C:\Documents and Settings\Root\Desktop\seex.pwn(167) : error 010: invalid function or declaration
C:\Documents and Settings\Root\Desktop\seex.pwn(169) : error 054: unmatched closing brace ("}")
C:\Documents and Settings\Root\Desktop\seex.pwn(171) : error 010: invalid function or declaration
C:\Documents and Settings\Root\Desktop\seex.pwn(175) : error 010: invalid function or declaration
C:\Documents and Settings\Root\Desktop\seex.pwn(177) : error 054: unmatched closing brace ("}")
C:\Documents and Settings\Root\Desktop\seex.pwn(179) : error 010: invalid function or declaration
C:\Documents and Settings\Root\Desktop\seex.pwn(183) : error 010: invalid function or declaration
C:\Documents and Settings\Root\Desktop\seex.pwn(185) : error 054: unmatched closing brace ("}")
C:\Documents and Settings\Root\Desktop\seex.pwn(187) : error 010: invalid function or declaration
C:\Documents and Settings\Root\Desktop\seex.pwn(191) : error 010: invalid function or declaration
C:\Documents and Settings\Root\Desktop\seex.pwn(193) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


12 Errors.
Can you tell me please whats the problem?:S.Thank you for support
PS:im a noob
Reply
#2

You have to put { brackets under the strcmp lines.
For example:

pawn Код:
if(!strcmp("/buy micro SMG", cmdtext, true))
{
   SendClientMessage(playerid,0xAA3333AA,"You have bought a Micro SMG for $4000.");
   GivePlayerWeapon(playerid, 28,200);
   GivePlayerMoney(playerid,-4000);
   return 1;
}
Reply
#3

Also, you should return 0 on the last line of COmmandText Callback

pawn Код:
if (strcmp("/buy micro SMG", cmdtext, true, 10) == 0){
        SendClientMessage(playerid,0xAA3333AA,"You have bought a Micro SMG.You lost 4000$");//
        GivePlayerWeapon(playerid, 28,200);
        GivePlayerMoney(playerid,-4000);
        return 1;

    }
   
    if (strcmp("/buy AK47", cmdtext, true, 10) == 0){
        SendClientMessage(playerid,0xAA3333AA,"You have bought an AK47.You lost 5000$");//
        GivePlayerWeapon(playerid, 30,200);
        GivePlayerMoney(playerid,-5000);
        return 1;

    }
   
    if (strcmp("/buy sniper rifle", cmdtext, true, 10) == 0){
        SendClientMessage(playerid,0xAA3333AA,"You have bought a Sniper Rifle.You lost 7000$");//
        GivePlayerWeapon(playerid, 34,25);
        GivePlayerMoney(playerid,-7000);
        return 1;

    }
   
    if (strcmp("/buy satchel charge", cmdtext, true, 10) == 0){
        SendClientMessage(playerid,0xAA3333AA,"You have bought a Sactchel Charge&Detonator.You lost 15000$");//
        GivePlayerWeapon(playerid, 39,5);
        GivePlayerMoney(playerid,-15000);
        return 1;

    }
   
    if (srcmp("/buy large white vibrator", cmdtext, true, 10) == 0){
        SendClientMessage(playerid,0xAA3333AA,"You have bought an Large White Vibrator.You lost 500$");//
        GivePlayerWeapon(playerid, 12,1);
        GivePlayerMoney(playerid,-500);
        return 1;}

    return 0;
}
Reply
#4

Код:
if (strcmp("/buy micro SMG", cmdtext, true, 10) == 0) {
		SendClientMessage(playerid,0xAA3333AA,"You have bought a Micro SMG.You lost 4000$");//
		GivePlayerWeapon(playerid, 28,200);
		GivePlayerMoney(playerid,-4000);
		return 1;

	}
	
	if (strcmp("/buy AK47", cmdtext, true, 10) == 0) {
		SendClientMessage(playerid,0xAA3333AA,"You have bought an AK47.You lost 5000$");//
		GivePlayerWeapon(playerid, 30,200);
		GivePlayerMoney(playerid,-5000);
		return 1;

	}
	
	if (strcmp("/buy sniper rifle", cmdtext, true, 10) == 0) {
		SendClientMessage(playerid,0xAA3333AA,"You have bought a Sniper Rifle.You lost 7000$");//
		GivePlayerWeapon(playerid, 34,25);
		GivePlayerMoney(playerid,-7000);
		return 1;

	}
	
	if (strcmp("/buy satchel charge", cmdtext, true, 10) == 0) {
		SendClientMessage(playerid,0xAA3333AA,"You have bought a Sactchel Charge&Detonator.You lost 15000$");//
		GivePlayerWeapon(playerid, 39,5);
		GivePlayerMoney(playerid,-15000);
		return 1;

	}
	
	if (srcmp("/buy large white vibrator", cmdtext, true, 10) == 0) {
		SendClientMessage(playerid,0xAA3333AA,"You have bought an Large White Vibrator.You lost 500$");//
		GivePlayerWeapon(playerid, 12,1);
		GivePlayerMoney(playerid,-500);
		return 0; //huh?
    }
	return 1; //huh?
}
return 0 means - SERVER: Unknown Command
Reply
#5

Tx guys,is fixed now.Also,ive problems with a command,for example i want the guns to be bought from a special place but i dont know how to do that.I tried to understand how to do it but when i tried to understand OnPLayerPoint i didnt got nothing for it.Anyone can tell me how to do it?
Reply
#6

Here :
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, float:range, float:x, float:y, float:z) == 0) return SendClientMessage(playerid, Color, "ERROR : You are not on the Special Place");
^ That means if the player isnt in the range of point of your Special Place
it will send him an error message.

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, float:range, float:x, float:y, float:z) == 1)
{
 // code here
}
^ that means that he is on the Range Of point of the special place
Reply
#7

can you guys help me with my 6 errors and a few warnings that im trying to fix but i cant here are the erros
warning 202: number of arguments does not match definition
C:\Documents and Settings\user\Desktop\samp03bsvr_R2_win32\pawno\sf pd.pwn(114) : warning 202: number of arguments does not match definition
C:\Documents and Settings\user\Desktop\samp03bsvr_R2_win32\pawno\sf pd.pwn(115) : warning 202: number of arguments does not match definition
C:\Documents and Settings\user\Desktop\samp03bsvr_R2_win32\pawno\sf pd.pwn(115) : warning 202: number of arguments does not match definition
C:\Documents and Settings\user\Desktop\samp03bsvr_R2_win32\pawno\sf pd.pwn(121) : warning 202: number of arguments does not match definition
C:\Documents and Settings\user\Desktop\samp03bsvr_R2_win32\pawno\sf pd.pwn(121) : warning 202: number of arguments does not match definition
C:\Documents and Settings\user\Desktop\samp03bsvr_R2_win32\pawno\sf pd.pwn(122) : warning 202: number of arguments does not match definition
C:\Documents and Settings\user\Desktop\samp03bsvr_R2_win32\pawno\sf pd.pwn(122) : warning 202: number of arguments does not match definition
C:\Documents and Settings\user\Desktop\samp03bsvr_R2_win32\pawno\sf pd.pwn(129) : error 010: invalid function or declaration
C:\Documents and Settings\user\Desktop\samp03bsvr_R2_win32\pawno\sf pd.pwn(134) : error 010: invalid function or declaration
C:\Documents and Settings\user\Desktop\samp03bsvr_R2_win32\pawno\sf pd.pwn(137) : error 010: invalid function or declaration
C:\Documents and Settings\user\Desktop\samp03bsvr_R2_win32\pawno\sf pd.pwn(139) : error 010: invalid function or declaration
C:\Documents and Settings\user\Desktop\samp03bsvr_R2_win32\pawno\sf pd.pwn(144) : error 010: invalid function or declaration
C:\Documents and Settings\user\Desktop\samp03bsvr_R2_win32\pawno\sf pd.pwn(145) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

and here is what i do

// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
#define FILTERSCRIPT
#include <a_samp>
#pragma tabsize 0
new sf;
new sf2;

#if defined FILTERSCRIPT


public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" SFPD Gates Created By GTRSkyYo");
print("--------------------------------------\n");
sf = CreateObject(980, -1624.64, 688.20, 9.00, 0.00, 0.00, 180.00);
sf2 = CreateObject(980, -1634.78, 688.19, 9.00, 0.00, 0.00, 180.00);
sf = CreateObject(980, -1624.64, 688.20, 14.00, 0.00, 0.00, 180.00);
sf2 = CreateObject(980, -1634.78, 688.19, 14.00, 0.00, 0.00, 180.00);
CreateObject(987, -1701.50, 701.23, 24.00, 0.00, 0.00, -92.00);
CreateObject(987, -1700.99, 712.96, 24.00, 0.00, 0.00, -92.00);
CreateObject(987, -1700.66, 720.02, 24.00, 0.00, 0.00, -92.00);
CreateObject(987, -1688.25, 720.30, 24.00, 0.00, 0.00, 184.00);
CreateObject(987, -1679.23, 719.07, 24.00, 0.00, 0.00, 174.00);
CreateObject(987, -1667.47, 719.43, 24.00, 0.00, 0.00, 181.00);
CreateObject(987, -1662.32, 718.68, 24.00, 0.00, 0.00, 174.00);
sf = CreateObject(980, -1701.59, 685.49, 26.66, 0.00, 0.00, 91.00);
sf2 = CreateObject(980, -1571.70, 661.54, 9.00, 0.00, 0.00, -90.00);
sf = CreateObject(980, -1701.80, 693.02, 26.66, 0.00, 0.00, 91.00);
sf2 = CreateObject(980, -1571.60, 653.37, 9.00, 0.00, 0.00, -90.00);
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

#else

main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}

public OnGameModeExit()
{
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}

public OnPlayerConnect(playerid)
{
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
return 1;
}

public OnPlayerSpawn(playerid)
{
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}

public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}

public OnPlayerText(playerid, text[])
{
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/sfpd2", cmdtext, true) == 0)
{
MoveObject(sf, -1624.64, 688.20, 9.00, 0.00, 0.00, 180.00);
MoveObject(sf2, -1634.78, 688.19, 9.00, 0.00, 0.00, 180.00);
SendClientMessage(playerid, 0x0000FFAA, "You Have Closed The San Fransico Deparment Gates");
return 1;
}
if (strcmp("/sfpd", cmdtext, true) == 0)
{
MoveObject(sf, -1624.64, 688.20, 14.00, 0.00, 0.00, 180.00);
MoveObject(sf2, -1634.78, 688.19, 14.00, 0.00, 0.00, 180.00);
SendClientMessage(playerid, 0x0000FFAA, "You Have Opened The San Fransico Deparment Gates");
return 1;
}

return 1;
}
if (strcmp("/sfpdb", cmdtext, true) == 0)
{
MoveObject(sf, -1701.59, 685.49, 26.66, 0.00, 0.00, 91.00);
MoveObject(sf2, -1571.70, 661.54, 9.00, 0.00, 0.00, -90.00);
SendClientMessage(playerid, 0x0000FFAA, "You Have Closed The San Fransico Deparment Gates Back");
return 1;
}

return 1;
}
if (strcmp("/sfpdmg", cmdtext, true) == 0)
{
MoveObject(sf, -1701.80, 693.02, 26.66, 0.00, 0.00, 91.00);
MoveObject(sf2, -1571.60, 653.37, 9.00, 0.00, 0.00, -90.00);
SendClientMessage(playerid, 0x0000FFAA, "You Have Opened The San Fransico Deparment MainGates");
return 1;}
return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
Reply
#8

You should probably also correct the spelling of 'strcmp' from 'srcmp' (what you currently have on your last line).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)