Ballas v.s Grove problem
#21

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
Reply
#22

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!
Reply
#23

Works thanks everybody!!
Reply
#24

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
Reply
#25

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

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

oh stupid mistake xD thank you
Reply
#27

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.
Reply
#28

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 ;.
Reply
#29

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 }.
Reply
#30

Oh,yeah,my bad
Reply
#31

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
Reply
#32

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!");}
Reply
#33

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.
Reply
#34

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.
Reply
#35

Just change

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

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?
Reply
#37

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).
Reply
#38

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.
Reply
#39

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


Forum Jump:


Users browsing this thread: 2 Guest(s)