Car Sapwner
#1

Hey Guys I did This:

pawn Код:
forward CarSpawner(playerid,model);
new pickup;

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == pickup)
    {
        ShowPlayerDialog(playerid, 2346, DIALOG_STYLE_LIST, "{6EF83C} UDC Cars Menu", "NRG-500\nFreeway\nBMX\nInfernus\nMonster truck\nCheetah\nSuper-GT", "Select", "Cancel");
        return 1;
    }

    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 2346)
    {
        if(response)
        {
            if(listitem == 0)
            {
           
                CarSpawner(playerid,522);
                GameTextForPlayer(playerid, "~r~Car ~g~Spawned!", 500, 0);
                SendClientMessage(playerid,COLOR_DARKRED,"Nrg-500 Has Been Spawned! Enjoy Your Stunts");
                }
        }
        return 1;
    }
   
    return true;

}
But It is Showing This Error:

pawn Код:
E:\UDCSER~1\GAMEMO~1\Wars.pwn(4896) : error 004: function "CarSpawner" is not implemented
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

you have no functions for carspawner
just a forward

pawn Код:
forward CarSpawner(playerid,model);
// should also have
public CarSpawner(playerid,model)
{

//some code
    return 1;
}
Reply
#3

Is there any way i can give player car according to above code. Like Give Player Car

Can any one give me full code. How to give car according to above code and how they get remove if no one is using them
Reply
#4

pawn Код:
stock CarSpawner(playerid,model,color1,color2)
{
   new vehicleid = GetPlayerVehicleID(playerid),Float:x,Float:y,Float:z,Float:q;
   model = vehicleid;
   if(!(model >=400 || model <=611)) printf("YOU HAVE ADD AN INVALID CAR ID !!"); // a bit different of color, it was printing wrong at least here.
   if(color1 <0 || color2 >255) printf("YOU HAVE ADD A COLOR 1 !!");
   if(color2 <0 || color2 >255) printf("YOU HAVE ADD A COLOR 2 !!");
   GetPlayerPos(playerid,x,y,z);
   CreateVehicle(model, x+5,y+5,z+10,q, color1, color2, 60);
   return 1;
}
//How to use? see below.
CarSpawner(playerid,432,0,0); // vehicle ID, COLOR 1, COLOR 2.
Reply
#5

Is above code is good. When i select nrg-500 according to above code it didn't give me vehicle. Only show game text. is there any problem in above code??
Reply
#6

try now... it is working here.
Reply
#7

Well, i have made another function, at least in my mind it should works fine, this one i didn't tested.

Well, i'm trying to do, is basically loop to add an id for the new car, So you can simple destroy it by the function located at exitvehicle.

pawn Код:
// top of gm
new cars[100];
#define car3 100
// ^^

stock CarSpawner(playerid,model,color1,color2)
{
   new vehicleid = GetPlayerVehicleID(playerid),Float:x,Float:y,Float:z,Float:q;
   model = vehicleid;
   if(!(model >=400 || model <=611)) printf("YOU HAVE ADD AN INVALID CAR ID !!");
   if(color1 <0 || color2 >255) printf("YOU HAVE ADD A COLOR 1 !!");
   if(color2 <0 || color2 >255) printf("YOU HAVE ADD A COLOR 2 !!");
   GetPlayerPos(playerid,x,y,z);
   for(new car=0;car<car3;car++)
   {
    if(car == car)car ++;
    if(car == 99) break;
    car++;
    cars[car] = CreateVehicle(model, x+5,y+5,z+10,q, color1, color2, 60);break;
   }
   return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
   DestroyVehicle(cars[0]); // to destroy de vehicle.
   DestroyVehicle(cars[1]); // to destroy de vehicle.
}
Reply
#8

why not just
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
   DestroyVehicle(vehicleid);
}
Reply
#9

Edit:
Thanks..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)