Creating a team
#1

Hey! I'm creating a team on my server. The ones who are in this team, is the only ones who can fly a Hydra. No one else can. I get errors and it doesnt work in-game, with this code;

Код:
     new PlayerName[24];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    
	if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == 520) //Checking if the player is the driver of a Hydra
    {
        if(!setTG[playerid] == 0)
        {
        	SendClientMessage(playerid,0xFF0000FF,"Players who's in the TG Force only!");
            RemovePlayerFromVehicle(playerid); //Removing the player from the vehicle
        }
    }
and..

Код:
	if (strcmp(cmdtext, "/setplayertg", true ) == 0)
	{
 		new tmp[256];
		tmp = strtok(cmdtext, idx);
	    new otherplayerid;
	    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_LIGHTRED, "Use /setplayertg [playerid/name]");
	    else if(!IsPlayerConnected(otherplayerid)) return SendClientMessage(playerid, COLOR_LIGHTRED, "This player is not connected");
	    else
	    {
	        SendClientMessage(otherplayerid,COLOR_LIGHTRED,"You've been set to [Team 2] by an [Admin].");
			setTG[otherplayerid] = 1;
	    }
	    return 1;
	}
You guys are probably laughing cuz this is totally noobish or ridiculous.. but yeah, I'm still kind of new in scripting
Reply
#2

if (newstate == PLAYER_STATE_DRIVER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 520)
Reply
#3

Heres the errors:
Код:
C:\Users\daniel\Desktop\FOLDERS\0.3x\2013 scripts\driftrevolution.pwn(1822) : warning 235: public function lacks forward declaration (symbol "SetPlayerWeapons")
C:\Users\daniel\Desktop\FOLDERS\0.3x\2013 scripts\driftrevolution.pwn(1842) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Warnings.
Reply
#4

Those warnings are completely irrelevant to the given code above.
Reply
#5

They come from this line though.. :

if(!setTG[playerid] == 0)
Reply
#6

Shouldn't it be SetPlayerWeapon instead of SetPlayerWeapons?
Reply
#7

if(!setTG[playerid]) also means if(setTG[playerid] == 0). So either you are looking for something that equals 0 or doesn't equal 0.

Doesn't equal 0
pawn Код:
if(setTG[playerid] != 0)
Equals 0
pawn Код:
if(!setTG[playerid])
or:
pawn Код:
if(setTG[playerid] == 0)
Reply
#8

Код:
if(!setTG[playerid])
<-- Thanks, that one worked! +rep on you

But now the other problem.. I have a command ingame.. /setplayertg [id] ..

Код:
	if (strcmp(cmdtext, "/setplayertg", true ) == 0)
	{
 		new tmp[256];
		tmp = strtok(cmdtext, idx);
	    new otherplayerid;
	    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_LIGHTRED, "Use /setplayertg [playerid/name]");
	    else if(!IsPlayerConnected(otherplayerid)) return SendClientMessage(playerid, COLOR_LIGHTRED, "This player is not connected");
	    else
	    {
	        SendClientMessage(otherplayerid,COLOR_LIGHTRED,"You've been set to [Team 2] by an [Admin].");
			setTG[otherplayerid] = 1;
	    }
	    return 1;
	}
when I type /setplayertg it says "Use /setplayertg [playerid/name]" , which it should say. - but when I put a random ID like my own id ( 0 ) , it says unknown command! How can this be fixed?
Reply
#9

can you show me the line of new setTG[ ] etc. ?

i the command i dont see any place where otherplayerid take the value
Reply
#10

It's used 3 places in the script. Both of the ones above ^ and ofcourse this one -->
Код:
 new setTG[MAX_PLAYERS];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)