SA-MP Forums Archive
Ballas v.s Grove problem - 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: Ballas v.s Grove problem (/showthread.php?tid=81000)

Pages: 1 2


Re: Ballas v.s Grove problem - Pawno_Master - 08.06.2009

lol
thanks i get it now
i have one last question

how to add a team

i now have grove
i now have Balla
and now i want vagos

How to add?
maybe i now it by myself but i ask for insurance xD
before i mess everything up again


Re: Ballas v.s Grove problem - lol2112 - 08.06.2009

Well you'll want to define another team. You'll probably have this at the top of your script:

Код:
#define TEAM_GROVE 0
#define TEAM_BALLAS 1
To add a team you want to add another define. So add this line after these:

Код:
#define TEAM_VAGOS 2
That's all!


Re: Ballas v.s Grove problem - Pawno_Master - 08.06.2009

Works thanks everybody!!


Re: Ballas v.s Grove problem - Pawno_Master - 08.06.2009

i have 1 little error

Код:
#define TEAM_GROVE 1
#define TEAM_BALLA 2
#define TEAM_VAGOS 3
#define TEAM_NORMAL 4
#define TEAM_GROVE_COLOR 0x00FF00AA // Bright Green (in RGBA format)
#define TEAM_BALLA_COLOR 0xFF00FFAA // Bright Purple
#define TEAM_VAGOS_COLOR 0xFFFF00AA // Yellow
#define TEAM_NORMAL_COLOR 0xFFFFFFAA // White

new gTeam[MAX_PLAYERS];

SetPlayerTeamFromClass(playerid)
{
  new classid = GetPlayerSkin(playerid);

  if (classid == 0) {
  	gTeam[playerid] = TEAM_GROVE; }
  if(classid == 105){
	gTeam[playerid] = TEAM_GROVE; }
	if(classid == 106){
	gTeam[playerid] = TEAM_GROVE; }
	if(classid == 107){
	gTeam[playerid] = TEAM_GROVE; }
  if(classid == 102){
  gTeam[playerid] = TEAM_BALLA; }
  if(classid == 103){
  gTeam[playerid] = TEAM_BALLA; }
  if(classid == 104){
  gTeam[playerid] = TEAM_BALLA; }
  if(classid == 108){
  gTeam[playerid] = TEAM_VAGOS; }
  if(classid == 109){
	gTeam[playerid] = TEAM_VAGOS; }
	if(classid == 110){
	gTeam[playerid] = TEAM_VAGOS
	}
  return 1;
}
this is my script

Код:
C:\Gta sa server\gamemodes\freeroam.pwn(38) : error 001: expected token: ";", but found "}"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
this is my little error help me plz



Re: Ballas v.s Grove problem - lol2112 - 08.06.2009

Код:
	if(classid == 110){
	gTeam[playerid] = TEAM_VAGOS
	}
needs to be

Код:
	if(classid == 110){
	gTeam[playerid] = TEAM_VAGOS;
	}



Re: Ballas v.s Grove problem - Pawno_Master - 08.06.2009

oh stupid mistake xD thank you


Re: Ballas v.s Grove problem - samgreen - 08.06.2009

Quote:
Originally Posted by Pawno_Master
i have 1 little error

Код:
if(classid == 110){
  gTeam[playerid] = TEAM_VAGOS; // Forgot a semi-colon on this line.
}
Код:
expected token: ";", but found "}"
Almost always means that you forgot to end a line with a semi-colon.


Re: Ballas v.s Grove problem - Luka P. - 08.06.2009

Quote:
Originally Posted by samgreen
Quote:
Originally Posted by Pawno_Master
i have 1 little error

Код:
if(classid == 110){
  gTeam[playerid] = TEAM_VAGOS; // Forgot a semi-colon on this line.
}
Код:
expected token: ";", but found "}"
Almost always means that you forgot to end a line with a semi-colon.
No,it means he forgot some bracket or ;.


Re: Ballas v.s Grove problem - Correlli - 08.06.2009

Quote:
Originally Posted by Luka™
Quote:
Originally Posted by samgreen
Quote:
Originally Posted by Pawno_Master
i have 1 little error

Код:
if(classid == 110){
  gTeam[playerid] = TEAM_VAGOS; // Forgot a semi-colon on this line.
}
Код:
expected token: ";", but found "}"
Almost always means that you forgot to end a line with a semi-colon.
No,it means he forgot some bracket or ;.
No, it means pawno-compiler expected ; but found }, so it means he forgot ; and not bracket }.


Re: Ballas v.s Grove problem - Luka P. - 08.06.2009

Oh,yeah,my bad


Re: Ballas v.s Grove problem - Pawno_Master - 09.06.2009

Hello again!

i tried to make a command for cops

Than i get a few errors

this is my script

Код:
	if (strcmp("/kill", cmdtext, true, 10) == 0)
	{
		SetPlayerHealth(playerid,0); // kills the player
		return 1;
	}
	if (strcmp("/commands", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid,0xAA3333AA,"For Commands type /gamecmds");// the players commands
		return 1;
	}
	if (strcmp("/gamecmds", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid,0xAA3333AA,"/animlist a list with animations");// the players commands
		SendClientMessage(playerid,0xAA3333AA,"/kill this command will kill you!");// killplayer command
		return 1;
	}
	if(strcmp(cmd,"/copcommands",true)==0)
{
    if(gTeam[playerid] == TEAM_COPS)
    {
    SendClientMessage(playerid,0xAA3333AA,"/cuff ID /arrest ID /fine ID /rp ID");
    else ;
    SendClientMessage(playerid,0xAA3333AA,"you are not a cop!");
    }
    return 1;
}
	return 1;
}
and this are my warnings

Код:
C:\Gta sa server\gamemodes\freeroam.pwn(361) : error 017: undefined symbol "cmd"
C:\Gta sa server\gamemodes\freeroam.pwn(366) : error 029: invalid expression, assumed zero
C:\Gta sa server\gamemodes\freeroam.pwn(366) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
code]

i don't know what i do wrong xD help me plz again



Re: Ballas v.s Grove problem - lol2112 - 09.06.2009

Change this:

Код:
SendClientMessage(playerid,0xAA3333AA,"/cuff ID /arrest ID /fine ID /rp ID");
    else if
    SendClientMessage(playerid,0xAA3333AA,"you are not a cop!");
to

Код:
SendClientMessage(playerid,0xAA3333AA,"/cuff ID /arrest ID /fine ID /rp ID"); }
    else if{
    SendClientMessage(playerid,0xAA3333AA,"you are not a cop!");}



Re: Ballas v.s Grove problem - Pawno_Master - 09.06.2009

than i get this

Код:
C:\Gta sa server\gamemodes\freeroam.pwn(361) : error 017: undefined symbol "cmd"
C:\Gta sa server\gamemodes\freeroam.pwn(367) : error 008: must be a constant expression; assumed zero
C:\Gta sa server\gamemodes\freeroam.pwn(367) : error 029: invalid expression, assumed zero
C:\Gta sa server\gamemodes\freeroam.pwn(369) : warning 217: loose indentation
C:\Gta sa server\gamemodes\freeroam.pwn(371) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: Ballas v.s Grove problem - lol2112 - 09.06.2009

You keep asking the same questions over and over again, and making the same mistakes repeatedly...just look through your code and you'll realise that your { and } are non-existent or misplaced.

If clauses need to look like this:

Код:
if(something)
{
}
and elses need to look like that as well but "else" instead of "if(something)"

Add:

Код:
new cmd[128];
to the top of those commands to sort your undefined error out.


Re: Ballas v.s Grove problem - Luka P. - 09.06.2009

Just change

pawn Код:
if (strcmp(cmd,"/copcommands",true)==0)
to
pawn Код:
if (strcmp("/copcommands", cmdtext, true, 10) == 0)



Re: Ballas v.s Grove problem - Correlli - 09.06.2009

Quote:
Originally Posted by Luka™
Just change

pawn Код:
if (strcmp(cmd,"/copcommands",true)==0)
to
pawn Код:
if (strcmp("/copcommands", cmdtext, true, 10) == 0)
12 is the length of /copcommands so why did you putted 10?


Re: Ballas v.s Grove problem - samgreen - 11.06.2009

Quote:
Originally Posted by lol2112
Add:

Код:
new cmd[128];
to the top of those commands to sort your undefined error out.
No! This is a typo! Redefining cmd at the top of the callback will result in some of his commands mysteriously failing. Do not take this advice.

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by Luka™
Just change

pawn Код:
if (strcmp(cmd,"/copcommands",true)==0)
to
pawn Код:
if (strcmp("/copcommands", cmdtext, true, 10) == 0)
12 is the length of /copcommands so why did you putted 10?
You both need to review the documentation on strings in the Pawn language specification. To recap, the method definition of strcmp follows:

strcmp(const string1[], const string2[], bool:ignorecase=false, length=cellmax)

string1 The first string in the comparison.
string2 The first string in the comparison.
ignorecase If logically “true”, case is ignored during the comparison.
length The maximum number of characters to consider for comparison.

The parameters with an equal following them indicate DEFAULT values (if you don't specify ignorecase it defaults to false). Not only are you using these parameters incorrectly, you are adding more work for yourself! The compiler can calculate length automatically for you, and I'm quite sure you don't want your commands to be case senstive (/copcommands should work just like /COPCOMMANDS).


Re: Ballas v.s Grove problem - Correlli - 11.06.2009

Quote:
Originally Posted by samgreen
You both need to review the documentation on strings in the Pawn language specification.
No i don't think so, i have readed that.


Re: Ballas v.s Grove problem - Geekzor - 11.06.2009

Quote:
Originally Posted by Luka™
Just indent your code.
at last warings do this again and wil lbe all ok ...