deleting vehicle onplayerdisconnect help
#1

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;
}
Reply
#2

VehicleOwner[i] is string and it holds the owner's name. You need the vehicleid:
pawn Код:
DestroyVehicle(i);
Reply
#3

VehicleOwner[i]
Must return a integer value not a string.
Reply
#4

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?
Reply
#5

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.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)