SA-MP Forums Archive
PutPlayerInVehicle[Rep] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: PutPlayerInVehicle[Rep] (/showthread.php?tid=323914)



PutPlayerInVehicle[Rep] - GNGification - 07.03.2012

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!


Re: PutPlayerInVehicle[Rep] - Shabi RoxX - 07.03.2012

Here there error you forgot [vehicleid]

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



Re: PutPlayerInVehicle[Rep] - Burridge - 07.03.2012

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);



Re: PutPlayerInVehicle[Rep] - GNGification - 07.03.2012

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

edit: Burridge rep for you too, for helping


Re: PutPlayerInVehicle[Rep] - livests - 07.03.2012

hey thanks me have same thing but with car shop


Re: PutPlayerInVehicle[Rep] - CAR - 07.03.2012

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