18.11.2015, 22:23
I have 3 vehicles saved to .ini files that the server saves / creates.
Vehicles are saved by their unique id, so I'm vehicles 0, 1 and 2.
Within each vehicle file, there is a line
where owner is a String.
Now the Callback OnPlayerEnterVehicle:
Notice that the line:
I do the compare string. If the player The name is the same as is in the variable vOwner, which takes the name of the player and then Send Client Message.
Until then everything was working fine. The ID: 0 of the vehicle had my name there in his file, the other 2 did not have my name and it worked correctly, the problem is:
A new player has entered the server and tested to me and he entered the Vehicle ID 0, and the message he received is that the vehicle was his, so the comparison does not work properly, and is in the file:
and the Player Name is totally different:
What did I be doing wrong?
I discovered another problem. I used the GetPlayerVehicleID function and print to see WHAT was happening And i discover that all vehicles is server has the ID: 0
This is the thread i've following: https://sampforum.blast.hk/showthread.php?tid=416104
Vehicles are saved by their unique id, so I'm vehicles 0, 1 and 2.
Within each vehicle file, there is a line
Код:
owner = PlayerName
Now the Callback OnPlayerEnterVehicle:
Код:
public OnPlayerEnterVehicle (playerid, vehicleid, ispassenger) { new string [256]; new SenderName [MAX_PLAYER_NAME]; GetPlayerName (playerid, SenderName, sizeof (SenderName)); if (togDebug [playerid] == 1) { if (! strcmp (VehicleInfo [vehicleid] [vOwner] SenderName)) { SendClientMessage (playerid, Color_White, "This vehicle is yours."); } else { SendClientMessage (playerid, Color_White, "This vehicle is not yours."); format (string, sizeof (string), "This vehicle is in the name of:%s." VehicleInfo [vehicleid] [vOwner]); SendClientMessage (playerid, Color_White, string); } } }
Код:
if (! strcmp (VehicleInfo [vehicleid] [vOwner] SenderName))
Until then everything was working fine. The ID: 0 of the vehicle had my name there in his file, the other 2 did not have my name and it worked correctly, the problem is:
A new player has entered the server and tested to me and he entered the Vehicle ID 0, and the message he received is that the vehicle was his, so the comparison does not work properly, and is in the file:
Код:
owner = Hayden_Almeida
Код:
Kaio_Vit
I discovered another problem. I used the GetPlayerVehicleID function and print to see WHAT was happening And i discover that all vehicles is server has the ID: 0
This is the thread i've following: https://sampforum.blast.hk/showthread.php?tid=416104