Help with park command.
#1

Can someone help me fix this command i made? Its not working... at all.

It lets anyone use the park command even if they use the car, it deletes the car and does not respawn it, and it returns an invalid CMD notice.

pawn Код:
COMMAND:park(playerid,params[])
{
    new ID = GetPlayerVehicleID(playerid);
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    new Float:PosL[4];
    new lString[100];
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in a vehicle!");
    if(isowned[ID]==0) return SendClientMessage(playerid,COLOR_RED,"This vehicle is not owned!");
    if(strcmp(name, vehicledata[ID][Owner], true) != 0) return SendClientMessage(playerid,COLOR_RED,"You do not own this vehicle!");
    GetVehiclePos(ID, PosL[0], PosL[1], PosL[2]);
    GetVehicleZAngle(ID, PosL[3]);
    vehicledata[ID][PosX] = PosL[0];
    vehicledata[ID][PosY] = PosL[1];
    vehicledata[ID][PosZ] = PosL[2];
    vehicledata[ID][PosA] = PosL[3];
    new mysql[200];
    format(mysql, sizeof(mysql), "UPDATE `ownedcars` SET `X` = '%f', `Y` = '%f', `Z` = '%d', `A` = '%f' WHERE `id` = '%d'", PosL[0], PosL[1], PosL[2], PosL[3], oid[ID]);
    mysql_query(mysql);
   
    DestroyVehicle(ID);
   
    new
        ownedcar = CreateVehicle(vehicledata[ID][Model], PosL[0], PosL[1], PosL[2], PosL[3], vehicledata[ID][Color1], vehicledata[ID][Color2], 120000);

    isowned[ownedcar] = 1;
    PutPlayerInVehicle(playerid, ownedcar, 0);
    printf("Car Spawned - Model: %d, Owner: %s Price: %d Is Owned %d",vehicledata[ID][Model],vehicledata[ID][Owner],vehicledata[ID][Price], isowned[ownedcar]);

    format(lString, sizeof(lString), "Owned by %s", vehicledata[ID][Owner]);
    print(lString);

    CreateDynamic3DTextLabel(lString, COLOR_YELLOW, PosL[0], PosL[1], PosL[2], 50, INVALID_PLAYER_ID, ownedcar, 0, -1, -1, -1, 50);
    SetVehicleNumberPlate(ownedcar, vehicledata[ID][Plate]);
    SetVehicleToRespawn(ownedcar);
    return 1;
}
Reply


Messages In This Thread
Help with park command. - by Rokzlive - 08.04.2011, 03:16
Re: Help with park command. - by Rokzlive - 09.04.2011, 16:35

Forum Jump:


Users browsing this thread: 1 Guest(s)