PutPlayerInVehicle[Rep]
#1

Little (stupid) question about PutPlayerInVehicle.

I havent scripted for a long time and now im tryining to remember stuff again... my problem is this.
When you got high enought killstreak, you can spawn a RC car. I tried to use PutPlayerInVehicle but I cannot
remember the right way.

pawn Code:
new RCcar[MAX_PLAYERS];
pawn Code:
if (strcmp("/ks 5", cmdtext, true, 10) == 0)
    {
        if(killstreak[playerid] == 8)
        {
            new Float:x, Float:y, Float:z;
            GetPlayerPos(playerid,x,y,z);
            RCcar = CreateVehicle(464,x,y,z, 0, 0, 3, 999999999);
            PutPlayerInVehicle(playerid, RCcar, 0);
            killstreak[playerid] = 0;
            SendClientMessage(playerid, COLOR_RED, "You have used your killstreak to get a RC car");
            SendClientMessage(playerid, COLOR_RED, "You have 120 seconds before your vehicle will blow.");
        }
    }
    return 1;
}
errors:
pawn Code:
H:\Pawno\pawno\LS.pwn(446) : error 033: array must be indexed (variable "RCcar")
H:\Pawno\pawno\LS.pwn(447) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Lines 466 & 467 are:
pawn Code:
RCcar = CreateVehicle(464,x,y,z, 0, 0, 3, 99999999999);
PutPlayerInVehicle(playerid, RCcar, 0);
Thank you for your time!
Reply
#2

Here there error you forgot [vehicleid]

pawn Code:
RCcar[vehicleid] = CreateVehicle(464,x,y,z, 0, 0, 3, 999999999);
Reply
#3

pawn Code:
new RCcar[MAX_PLAYERS];
should be
pawn Code:
new RCcar[MAX_VEHICLES];
Then
pawn Code:
RCcar = CreateVehicle(464,x,y,z, 0, 0, 3, 999999999);
should be
pawn Code:
RCcar[vehicleid] = CreateVehicle(464,x,y,z, 0, 0, 3, 999999999);
This means you'll need to define vehicleid in that command. Then
pawn Code:
PutPlayerInVehicle(playerid, RCcar, 0);
also becomes
pawn Code:
PutPlayerInVehicle(playerid, RCcar[vehicleid], 0);
Reply
#4

Thank you Shabi! fixed both errors and fully working
rep+ for you

edit: Burridge rep for you too, for helping
Reply
#5

hey thanks me have same thing but with car shop
Reply
#6

I thought it needed to be RCcar[playerid] because you spawn a personal car right?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)