Creating a team -
Kudoz - 09.06.2013
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
AW: Creating a team -
HurtLocker - 09.06.2013
if (newstate == PLAYER_STATE_DRIVER && GetVehicleModel(GetPlayerVehicleID(playerid)) == 520)
Re: Creating a team -
Kudoz - 09.06.2013
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.
AW: Creating a team -
HurtLocker - 09.06.2013
Those warnings are completely irrelevant to the given code above.
Re: Creating a team -
Kudoz - 09.06.2013
They come from this line though.. :
if(!setTG[playerid] == 0)
Re: Creating a team -
Goldilox - 10.06.2013
Shouldn't it be
SetPlayerWeapon instead of
SetPlayerWeapons?
Re: Creating a team -
Threshold - 10.06.2013
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
Equals 0
or:
Re: Creating a team -
Kudoz - 10.06.2013
Код:
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?
Re: Creating a team -
ReVo_ - 10.06.2013
can you show me the line of new setTG[ ] etc. ?
i the command i dont see any place where otherplayerid take the value
Re: Creating a team -
Kudoz - 10.06.2013
It's used 3 places in the script. Both of the ones above ^ and ofcourse this one -->
Код:
new setTG[MAX_PLAYERS];