Gates...
#1

I got the moving gates working because of Bruzer's tutorial, but I have a teeny question...

Can I do something like
if username = Frazz
Opens gate
if username not Frazz
You are not allowed to open the gate!

You know what I mean?
Reply
#2

Im not sure about Names, but i know you can do it with teams.

Example :
Quote:

if (gTeam[playerid] == TEAM_GROVE)
{

Reply
#3

pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
if(strcmp(name,"Frazz",true) == 0)
{
MoveObject(...,...,...,...);
}
else
{
SendClientMessage(playerid, COLOR_RED, "No");
}
Reply
#4

When I click compile, it says Pawn Compiler has Stopped Working.

Code:
Код:
//-------------------------------[FrazZ's Gate]---------------------------------
	if(strcmp(cmd, "/fgateopen", true) == 0) { // Edit the /eup to your elevator command.
   if (PlayerInfo[playerid][pAdmin] >= 1337)
   new name[MAX_PLAYER_NAME];
	 GetPlayerName(playerid,playername,sizeof(playername));
	 if(strcmp(name,"FrazZ",true) == 0)
	 MoveObject(frazzgate,1535.32,-1451.32,9.70,2.00); // Put your cords in here
	 }
	 else
   {
	 SendClientMessage(playerid, COLOR_RED, "No");
	 }
   return 1;
   }
   
 	if(strcmp(cmd, "/fgateclose", true) == 0) { // Same deal as before
   if (PlayerInfo[playerid][pAdmin] >= 1337)
   new name[MAX_PLAYER_NAME];
	 GetPlayerName(playerid,playername,sizeof(playername));
	 if(strcmp(name,"FrazZ",true) == 0)
	 MoveObject(frazzgate,1535.32,-1451.32,15.00,2.00); // Same deal as before
	 }
	 else
	 {
	 SendClientMessage(playerid, COLOR_RED, "No");
	 }
   return 1;
   }
EDIT: The reason why If Admin = 1337 is there is because if someone else goes on with the name FrazZ and uses the command, they can open it... but with the admin thing they can't.
Reply
#5

why don't you look through the basics of scripting in the pawn-lang.pdf? Your answer is quite a beginners question.. Brackets
Reply
#6

GF and pen just have many useless things.... Check it out.
Reply
#7

Wow. No-one can just help me?
Quote:
Originally Posted by [NT
Zer0 ]
why don't you look through the basics of scripting in the pawn-lang.pdf? Your answer is quite a beginners question.. Brackets
I will keep that in mind.
Quote:
Originally Posted by MenaceX^
GF and pen just have many useless things.... Check it out.
True, but thats why im adding useful things.
Reply
#8

the error is because you didnt add brackets, try this. i just started scripting so its a 50/50 chance it will work....lol, but thats how i build gates just without the "if(strcmp(name,"FrazZ",true) == 0)"
so i guess it should work
Код:
//-------------------------------[FrazZ's Gate]---------------------------------
	if(strcmp(cmd, "/fgateopen", true) == 0) { // Edit the /eup to your elevator command.
	(
		new name[MAX_PLAYER_NAME];
		if (PlayerInfo[playerid][pAdmin] >= 1337)
		{
 			if(strcmp(name,"FrazZ",true) == 0)
 			{
				GetPlayerName(playerid,playername,sizeof(playername));
				MoveObject(frazzgate,1535.32,-1451.32,9.70,2.00); // Put your cords in here
			}
		}
	 	else
   	{
	 	SendClientMessage(playerid, COLOR_RED, "No");
	 	}
   	return 1;
   	}

 	if(strcmp(cmd, "/fgateclose", true) == 0) { // Same deal as before
	{
 		new name[MAX_PLAYER_NAME];
 		if (PlayerInfo[playerid][pAdmin] >= 1337)
		{
			if(strcmp(name,"FrazZ",true) == 0)
			{
				GetPlayerName(playerid,playername,sizeof(playername));
				MoveObject(frazzgate,1535.32,-1451.32,15.00,2.00); // Same deal as before
			}
		}
	}
	else
	{
	SendClientMessage(playerid, COLOR_RED, "No");
	}
	return 1;
	}
Reply
#9

C:\Users\Pivot\Desktop\FRLS\gamemodes\penls.pwn(85 76 -- 8577) : error 029: invalid expression, assumed zero
C:\Users\Pivot\Desktop\FRLS\gamemodes\penls.pwn(85 77) : warning 217: loose indentation
C:\Users\Pivot\Desktop\FRLS\gamemodes\penls.pwn(85 77) : warning 215: expression has no effect
C:\Users\Pivot\Desktop\FRLS\gamemodes\penls.pwn(85 77) : error 001: expected token: ";", but found "]"
C:\Users\Pivot\Desktop\FRLS\gamemodes\penls.pwn(85 77) : error 029: invalid expression, assumed zero
C:\Users\Pivot\Desktop\FRLS\gamemodes\penls.pwn(85 77) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#10

Learn to indent.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)