29.06.2012, 18:34
Well there is a change players car command and when ever i do it when it spawns it ends up in the middle of nowhere and sometimes it falls through the map and it dont go tot he coordinates i wanted it to do to
If you need any more code just ask
Thanks
pawn Code:
command(changeplayercar, playerid, params[])
{
new id, carid, vehslot, string[128];
if(sscanf(params, "udd", id, carid, vehslot))
{
if(Player[playerid][AdminLevel] >= 5)
{
SendClientMessage(playerid, WHITE, "SYNTAX: /changeplayercar [playerid] [carid] [1-4]");
}
}
else
{
if(Player[playerid][AdminLevel] >= 5)
{
if(IsPlayerConnectedEx(id))
{
switch(vehslot)
{
case 1:
{
if(carid >= 400 && carid < 611)
{
if(Player[id][PlayerCarModel] >= 1)
{
if(Player[id][CarLinkID] >= 1)
{
DestroyVehicle(Player[id][CarLinkID]);
Player[id][CarLinkID] = 0;
OwnedCarCount--;
CarCount--;
}
Player[playerid][OwnedCarModSlot0] = 0;
Player[playerid][OwnedCarModSlot1] = 0;
Player[playerid][OwnedCarModSlot2] = 0;
Player[playerid][OwnedCarModSlot3] = 0;
Player[playerid][OwnedCarModSlot4] = 0;
Player[playerid][OwnedCarModSlot5] = 0;
Player[playerid][OwnedCarModSlot6] = 0;
Player[playerid][OwnedCarModSlot7] = 0;
Player[playerid][OwnedCarModSlot8] = 0;
Player[playerid][OwnedCarModSlot9] = 0;
Player[playerid][OwnedCarModSlot10] = 0;
Player[playerid][OwnedCarModSlot11] = 0;
Player[playerid][OwnedCarModSlot12] = 0;
Player[playerid][OwnedCarModSlot13] = 0;
Player[id][PlayerCarModel] = carid;
GetVehiclePos(Player[playerid][CarLinkID], Player[playerid][CarX], Player[playerid][CarY], Player[playerid][CarZ]);
GetVehicleZAngle(Player[playerid][CarLinkID], Player[playerid][CarZAngle]);
SetVehiclePos(Player[playerid][CarLinkID], 2126.1855,-1132.2913,25.4993);
SpawnOwnedCar(id, 1);
format(string, sizeof(string), "You have changed %s's car model %d for their owned car (slot 1)", GetName(id), carid);
SendClientMessage(playerid, WHITE, string);
}
else
{
Player[id][PlayerCarModel] = carid;
SpawnOwnedCar(id, 1);
format(string, sizeof(string), "You have given %s car model %d for their owned car (slot 1)", GetName(id), carid);
SendClientMessage(playerid, WHITE, string);
}
}
else
{
SendClientMessage(playerid, WHITE, "Invalid car ID!");
}
}
}
}
}
}
}
Thanks