Need a bit help with this error
#1

I made one code to park vehicle and despawn at same time.. And now i finished.. the code to spawn it again but im getting one error here is my code to spawn
pawn Код:
else if(strcmp(x_v,"get1",true) == 0)
            {
                if(IsPlayerConnected(playerid))
                 {
                     if(Account[playerid][pPcarkey1] == 999 && Account[playerid][pPcarkey2] == 999 && Account[playerid][pPcarkey3] == 999)
                    {
                        SendClientMessage(playerid,COLOR_LIGHTRED,"ERROR: You do not own a car!");
                        return true;
                    }
                     new carkey1 = Account[playerid][pPcarkey1];
                    GetPlayerName(playerid, playername, sizeof(playername));
                    if(IsPlayerInVehicle(playerid, carkey1))
                    {
                        SendClientMessage(playerid,COLOR_LIGHTRED,"ERROR: You are in your car...");
                        return true;
                    }
                    {
                            CreateVehicle(carkey1, VehicleInfo[carkey1][cLocationx], VehicleInfo[carkey1][cLocationy], VehicleInfo[carkey1][cLocationz]);
                            TextDrawSetString(Textdrawz[playerid],"~w~Info: Your car its parked at same place where you parked it.");
                            TextDrawShowForPlayer(playerid,Textdrawz[playerid]);
                            NoText[playerid]=5;
                            OnPlayerUpdate(playerid);
                            return true;
                       }
                }
            }
Quote:

ERROR:number of arguments does not match definition

EDIT: the error line its at "CreateVehicle"
Reply
#2

serach for "CreateVehicle" on samp wiki and then you will have your answer..


(Arguemnts is each parameter)
Reply
#3

Alright but how can i fix it? i need to load the location of the car
Reply
#4

You are missing parameters.
https://sampwiki.blast.hk/wiki/CreateVehicle

pawn Код:
(modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay)
You got: Modelid, X, Y, Z.
So basically you will need Angle, Color1, Color2, Respawn_Delay.

For further information what each parameter does read the Wiki however I believe it's really easy to understand what each parameter means.

Edit:
pawn Код:
CreateVehicle(carkey1, VehicleInfo[carkey1][cLocationx], VehicleInfo[carkey1][cLocationy], VehicleInfo[carkey1][cLocationz], Angle, Color1, Color2, Respawn_Delay);
So basically you could copy the above line, And change the parameters I added to your needs and that should fix the problem.(Angle, Color1, Color2, Respawn_Delay)
Reply
#5

CreateVehicle(carkey1, VehicleInfo[carkey1][cLocationx], VehicleInfo[carkey1][cLocationy], VehicleInfo[carkey1][cLocationz], 0, -1, -1, 60000);

You need to give the car's angle, 2 colors nad the respawn time.. that will get rid of errors, but the car will be spawned with a strange angle..
Reply
#6

Oh lol i added the angle from the vehicle info enum and it compiled just need test Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)