SA-MP Forums Archive
Help with park command. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with park command. (/showthread.php?tid=247155)



Help with park command. - Rokzlive - 08.04.2011

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;
}



Re: Help with park command. - Rokzlive - 09.04.2011

Please help.