30.03.2013, 11:28
hello guys, help me with car spawn
car spawn is no work..
pawn Код:
CMD:v(playerid, params[])
{
new Vehicle[32], VehicleID, ColorOne, ColorTwo;
PlayerInfo[playerid][pCanSpawnVehicle] = true;
if(sscanf(params, "s[32]D(1)D(1)", Vehicle, ColorOne, ColorTwo))
{
PlayerInfo[playerid][pCanSpawnVehicle] = true;
SendClientMessage(playerid, COLOR_GREY, "[USAGE]: /v[Vehiclename/Vehicleid] [Color 1 (optional)] [Color 2 (optional)]");
SendClientMessage(playerid, COLOR_GREY, "[USAGE]: Like /v Turismo , /v Elegy /v Nrg /v 522");
return 1;
}
if(PlayerInfo[playerid][pCanSpawnVehicle])
{
VehicleID = GetVehicleModelIDFromName(Vehicle);
if(VehicleID != 425 && VehicleID != 432 && VehicleID != 447 &&
VehicleID != 430 && VehicleID != 417 && VehicleID != 435 &&
VehicleID != 446 && VehicleID != 449 && VehicleID != 450 &&
VehicleID != 452 && VehicleID != 453 && VehicleID != 454 &&
VehicleID != 460 && VehicleID != 464 && VehicleID != 465 &&
VehicleID != 469 && VehicleID != 472 && VehicleID != 473 &&
VehicleID != 476 && VehicleID != 484 && VehicleID != 487 &&
VehicleID != 488 && VehicleID != 493 && VehicleID != 497 &&
VehicleID != 501 && VehicleID != 511 && VehicleID != 512 &&
VehicleID != 513 && VehicleID != 519 && VehicleID != 520 &&
VehicleID != 537 && VehicleID != 538 && VehicleID != 548 &&
VehicleID != 553 && VehicleID != 563 && VehicleID != 564 &&
VehicleID != 569 && VehicleID != 570 && VehicleID != 577 &&
VehicleID != 584 && VehicleID != 590 && VehicleID != 591 &&
VehicleID != 592 && VehicleID != 593 && VehicleID != 594 &&
VehicleID != 595 && VehicleID != 606 && VehicleID != 607 &&
VehicleID != 608 && VehicleID != 610 && VehicleID != 611) {
if(VehicleID == -1 )
{
VehicleID = strval(Vehicle);
if(VehicleID < 400 || VehicleID > 611 )
{
return SendClientMessage(playerid, COLOR_GREY, "You entered an invalid vehiclename!");
}
}
GetPlayerPos(playerid, pX, pY, pZ);
GetPlayerFacingAngle(playerid, pAngle);
DestroyVehicle(PlayerInfo[playerid][pSpawnVehicle]);
PlayerInfo[playerid][pSpawnVehicle] = CreateVehicle(VehicleID, pX, pY, pZ+2.0, pAngle, ColorOne, ColorTwo, -1);
LinkVehicleToInterior(PlayerInfo[playerid][pSpawnVehicle], GetPlayerInterior(playerid));
PutPlayerInVehicle(playerid, PlayerInfo[playerid][pSpawnVehicle], 0);
SendClientMessage(playerid, COLOR_GREY, "You succesfully spawned this vehicle!");
} else {
SendClientMessage(playerid, COLOR_GREY, "You are not allowed to spawn this vehicle!!");
}
} else {
SendClientMessage(playerid, COLOR_GREY, "You can not spawn vehicles in this zone!");
}
return 1;
}