deleting vehicle onplayerdisconnect help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: deleting vehicle onplayerdisconnect help (
/showthread.php?tid=520596)
deleting vehicle onplayerdisconnect help -
iThePunisher - 19.06.2014
i wanted to delete vehicle when onplayerdisconnect but im getting an error :/
this is the error:
pawn Код:
C:\Users\----\---\--\filterscripts\puntest.pwn(900) : error 035: argument type mismatch (argument 1)
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new playername[24];
GetPlayerName(playerid, playername, sizeof(playername));
for(new i=1; i < MAX_PUNVEHICLES; i++)
{
if(VehicleCreated[i] == VEHICLE_PLAYER && strcmp(VehicleOwner[i], playername) == 0)
{
DestroyVehicle(VehicleOwner[i]); //destroy it.
print("A vehicle has been deleted");
}
}
return 1;
}
Re: deleting vehicle onplayerdisconnect help -
Konstantinos - 19.06.2014
VehicleOwner[i] is string and it holds the owner's name. You need the vehicleid:
Re: deleting vehicle onplayerdisconnect help -
Excel™ - 19.06.2014
VehicleOwner[i]
Must return a integer value not a string.
Re: deleting vehicle onplayerdisconnect help -
iThePunisher - 19.06.2014
thanks both of you.
Ps, what you think the code i made will delete the owned cars when the player who own the vehicle will diconnect?
Re: deleting vehicle onplayerdisconnect help -
Bek_Loking - 19.06.2014
Of course it will. The code is correct as konstantions said, make it like that, I'll join your server and you can check if you're unsure.