Command Help.
#1

I want to make it so that only "Scouts" can use the command "/hide".
Which makes it so that their blip goes invisible on the map.

Current Code:
Код:
	//----------IN GAME ZOMBIE COMMANDS----------
	if(classid == 5)
	if(strcmp("/hide", cmdtext, true, 5) == 0)
	{
		SetPlayerMarkerForPlayer(playerid,1,00);
		SendClientMessage(playerid,0xFF0000AA,"You've concealed yourself.");
	}
	else
	    SendClientMessage(playerid, 0xFF0000AA, "Only Scouts may use this command.");
		return 1;
}
The error is:
C:\Program Files\Rockstar Games\GTA San Andreas\My Server\gamemodes\Zombie.pwn(375) : error 017: undefined symbol "classid"


How would I define "classid"?


^^ Thank You.
Reply
#2

------
Reply
#3

Yeah, I used it on OnPlayerRequestClass for class selection things. ^^
That's what gave me the idea to be able to use "if(classid == NUMBER)" for
commands.


I have no clue how I'd go about making it get the classid #
>_<

But I know for pickups its

"PickupName = CreatePickup ______________"

So would it be something along those lines?
Reply
#4

------
Reply
#5

What if Classid 5 is already on a team? >_<
Reply
#6

------
Reply
#7

Just entered it all, and am going to test..One second.


Err..It complied perfectly. Except, I think somewhere I fudged
up the teams? Because when I type in the chat box, the red
team comes up as blue team? But i'll edit again once I get that
fixed. Dx
Reply
#8

------
Reply
#9

EDIT -

For some reason the command is switching all of the red team
over to the blue team..So nobody can use the command.

Here's the code i'm using.

Код:
	//----------IN GAME ZOMBIE COMMANDS----------
	if(gTeam[playerid] == TEAM_ZOMBIES)
	{
	    if(strcmp("/hide", cmdtext, true, 5) == 0)
		{
		    SetPlayerMarkerForPlayer(playerid,1,00);
		    SendClientMessage(playerid,0xFF0000AA,"You've concealed yourself.");
		}
	}
	        else
	        SendClientMessage(playerid, 0xFF0000AA, "Only Scouts may use this command.");
		return 1;
 }
It compiles perfectly, though.
Reply
#10

------
Reply
#11

x-x
above script:
Код:
new gTeam[MAX_PLAYERS];

SetPlayerToTeamColor(playerid)
{
	if(gTeam[playerid] == TEAM_SURVIVORS)
	{
	    SetPlayerColor(playerid, TEAM_SURVIVORS_COLOR);
	}
	else if(gTeam[playerid] == TEAM_ZOMBIES)
	{
	    SetPlayerColor(playerid, TEAM_ZOMBIES_COLOR);
	}
	}
	
SetPlayerTeamFromClass(playerid, classid)
{
	if(classid == 0)
	{
	gTeam[playerid] = TEAM_SURVIVORS;
	return 1;
	}
	if(classid == 1)
	{
	gTeam[playerid] = TEAM_SURVIVORS;
	return 1;
	}
	if(classid == 2)
	{
	gTeam[playerid] = TEAM_SURVIVORS;
	return 1;
	}
	if(classid == 3)
	{
	gTeam[playerid] = TEAM_SURVIVORS;
	return 1;
	}
	else if(classid == 4)
	{
 	gTeam[playerid] = TEAM_ZOMBIES;
	}
	return 1;
	}
>_< I have no clue how that's wrong, either.
Reply
#12

Quote:
Originally Posted by BJaxx
Посмотреть сообщение
x-x
above script:
Код:
new gTeam[MAX_PLAYERS];

SetPlayerToTeamColor(playerid)
{
	if(gTeam[playerid] == TEAM_SURVIVORS)
	{
	    SetPlayerColor(playerid, TEAM_SURVIVORS_COLOR);
	}
	else if(gTeam[playerid] == TEAM_ZOMBIES)
	{
	    SetPlayerColor(playerid, TEAM_ZOMBIES_COLOR);
	}
	}
	
SetPlayerTeamFromClass(playerid, classid)
{
	if(classid == 0)
	{
	gTeam[playerid] = TEAM_SURVIVORS;
	return 1;
	}
	if(classid == 1)
	{
	gTeam[playerid] = TEAM_SURVIVORS;
	return 1;
	}
	if(classid == 2)
	{
	gTeam[playerid] = TEAM_SURVIVORS;
	return 1;
	}
	if(classid == 3)
	{
	gTeam[playerid] = TEAM_SURVIVORS;
	return 1;
	}
	else if(classid == 4)
	{
 	gTeam[playerid] = TEAM_ZOMBIES;
	}
	return 1;
	}
>_< I have no clue how that's wrong, either.
try

pawn Код:
if(classid == 0 || 1 || 2 || 3)
{
GameTextForPlayer(playerid,"Human",6000,4);
gTeam[playerid] = TEAM_HUMAN;
}
if(classid 4)
{
GameTextForPlayer(playerid,"Zombie",6000,4);
gTeam[playerid] = TEAM_ZOMBIES;
}
Reply
#13

Still wont work.

Zombies come up as Humans.
I switch it into the MUCH shorter way you suggested, thank you for that. ^^
But it still didn't do anything.

I just can't see what's wrong with it?

I'm thinking that the
"if(gTeam[playerid] == TEAM_ZOMBIES)"
in the /hide command is throwing it off, somehow?
Reply
#14

show me your defines of you teams and how many Addplayerclass you have
Reply
#15

Код:
#define TEAM_SURVIVORS 1
#define TEAM_ZOMBIES 2
Код:
	//Survivors
AddPlayerClass(217,-782.7656,2440.5020,158.4970,155.7643,31,1000,33,1000,26,1000);//James
AddPlayerClass(115,-782.7656,2440.5020,158.4970,155.7643,18,5,24,1000,28,1000);//Fredrick
AddPlayerClass(112,-782.7656,2440.5020,158.4970,155.7643,30,3000,0,0,16,10);//Tony
AddPlayerClass(211,-782.7656,2440.5020,158.4970,155.7643,22,500,25,750,42,200);//Sarah
    
	//Zombies
AddPlayerClass(160,1287.0096,173.9007,20.4609,63.3573,0,0,0,0,0,0);
AddPlayerClass(162,1295.0973,303.6454,27.5555,299.8996,0,0,0,0,0,0);
AddPlayerClass(183,1362.6400,249.5690,19.5669,69.0975,1,0,0,0,0,0);
AddPlayerClass(264,1287.0096,173.9007,20.4609,63.3573,9,1,0,0,0,0);
Reply
#16

<_< Bump.

I know it says to wait 48 hours, but this got moved back 3 or 4 pages,
and I want this over with, and not wait another day just to bump. >_<
Reply
#17

sorry i just came back from work.

try

pawn Код:
#define TEAM_SURVIVORS 0
#define TEAM_ZOMBIES 1
Reply
#18

Weird :P

Код:
SetPlayerTeamFromClass(playerid, classid)
{
	if(classid == 0 || 1 || 2|| 3)
	{
	gTeam[playerid] = TEAM_SURVIVORS;
	}
	if(classid == 4)
	{
	gTeam[playerid] = TEAM_ZOMBIES;
	}
	if(classid == 5)
	{
	gTeam[playerid] = TEAM_ZOMBIES;
	}
	if(classid == 6)
	{
	gTeam[playerid] = TEAM_ZOMBIES;
	}
	if(classid == 7)
	{
	gTeam[playerid] = TEAM_ZOMBIES;
	}
}
Worked great. Everybody is on the right team.

But putting id's 4-7 like how i did 0-3 didn't work at all. xD



NOW, new question.
All of the humans can't use the command, because they're not on the zombie team. (good )
However, all of the zombies can use it. I only want the "Scout" (classid 5) to be able to use it.
^^
Reply
#19

pawn Код:
if(gTeam[playerid] == TEAM_ZOMBIES)
          // your command that u want zombies to use.
Reply
#20

Yeah, but I want ONLY the Scouts to be able to use it.

Scouts are 1 of the Zombie Sub-Classes. ;]
And they should only be able to use /hide.
but as it is now, all zombies can.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)