17.05.2012, 06:11
That made no sense as to what I'm asking.
I've got the teams added, yes.
I use GetPlayerTeam not gTeam.
I prefer it that way, with the #define's.
I just want to know; will this work?
I've got the teams added, yes.
I use GetPlayerTeam not gTeam.
I prefer it that way, with the #define's.
I just want to know; will this work?
pawn Код:
stock LoadVehicles()
{
new
Str[128],
dModel,
Float:VX,
Float:VY,
Float:VZ,
Float:VA,
Team,
col1,
col2,
vTotal;
mysql_query("SELECT * FROM `vehicles`");
mysql_store_result();
if(mysql_num_rows() > 0)
{
while(mysql_fetch_row(Str))
{
sscanf(Str, "p<|>iffffiii", dModel, VX, VY, VZ, VA, Team, col1, col2);
CreateVehicle(dModel, VX, VY, VZ, VA, col1, col2, -1);
vTotal++;
}
}
mysql_free_result();
printf("%i vehicles loaded from the MySQL Database.", vTotal);
for(new i = 0; i < MAX_VEHICLES; i++)
{
VehicleTeam[i] = Team;
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
{
if(GetPlayerTeam(playerid) == VehicleTeam[GetPlayerVehicleID(playerid)])
{
return 1;
}
else
{
SendClientMessage(playerid, WHITE, "You're not allowed to drive this vehicle.");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}