for(new i=0; i<sizeof(cInfo); i++)
{
if(cInfo[i][carteam]==255)
{
if(cInfo[i][id_x]==0)continue;
if(cInfo[i][carowner] != PlayerInfo[playerid][pusername])continue;
DestroyVehicle(cInfo[i][id_x]);
cInfo[i][id_x]=0;
}
if(cInfo[i][carowner] != PlayerInfo[playerid][pusername])
if(!strcmp(cInfo[i][carowner],PlayerInfo[playerid][pusername]))
for(new i=0; i<sizeof(cInfo); i++)
for(new i = GetVehiclePoolSize(); i > 0; i--)
|
This is not helping at all..
-- Show us your cInfo. Also why do you set PHP код:
PHP код:
|
|
Originally Posted by Dayrion
Also why do you set
PHP код:
PHP код:
|
enum carEnum{
id_x,
carowner[MAX_PLAYER_NAME],
carmodelid,
Float:c_x,
Float:c_y,
Float:c_z,
Float:c_r,
c_color1,
c_color2,
c_respawntime,
cnitro,
paintjob,
plate,
c_autorespawn,
carteam,
db_id,
}
new cInfo[1000][carEnum];
enum carEnum{
id_x,
carowner[MAX_PLAYER_NAME], // Since you have this variable, only player-created vehicles will be used in this enum.
carmodelid,
Float:c_x,
Float:c_y,
Float:c_z,
Float:c_r,
c_color1,
c_color2,
c_respawntime,
cnitro,
paintjob,
plate,
c_autorespawn,
carteam,
db_id
};
new cInfo[MAX_PLAYERS][carEnum]; // Changed to MAX_PLAYERS. This enum is related to player-created vehicles, no vehicles created by the server. Right?
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
cInfo[playerid][id_x] = CreateVehicle(...) // We store the vehicle id on playerid -> id_x variable.
cInfo[playerid][carmodelid] = GetPlayerVehicleModelID(cInfo[playerid][id_x]); // Stuff..
cInfo[playerid][c_x] = X; // Stuff..
cInfo[playerid][c_y] = Y; // Stuff..
cInfo[playerid][c_z] = Z; // More Stuff..
cInfo[playerid][c_r] = A; // Etc..
public OnPlayerConnect(playerid)
{
// Set id_x to -1.. (You should reset the entire enum to their original values when a player connects)
cInfo[playerid][id_x] = -1; // We set it to -1, because what if the player creates a vehicles, when there is no other vehicle created yet?.
// for(;;) cInfo[playerid][Enum_Variable] = DEFAULT_VALUE ...
return 1;
}
// Player-created vehicle, no loop needed. Just a check if the vehicle has been created.
public OnPlayerDisconnect(playerid, reason)
{
// You check if carteam is 255 so..
if(cInfo[playerid][carteam] == 255 && cInfo[playerid][id_x] >= 0) DestroyVehicle(cInfo[playerid][id_x]);
// Then you must reset id_x.. (You should reset the entire enum to their original values, again)
cInfo[playerid][id_x] = -1;
// for(;;) cInfo[playerid][Enum_Variable] = DEFAULT_VALUE ...
return 1;
}