SA-MP Forums Archive
Car - 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: Car (/showthread.php?tid=347629)



Car - Edin Black - 02.06.2012

I can not give a another player the car - Help please.

pawn Код:
if(strcmp(cmd, "/car", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
      tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_DGOLD, "KORISTENJE: /car [ID/DioImena]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 3)
            {
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        PutPlayerInVehicle(playerid, 424, 0);
                        return 1;
                    }
                }//not connected
            }
            else
            {
                format(string, sizeof(string), "ERROR: Igrac %s nije aktivan igrac. Pokusajte kasnje opet.", giveplayerid);
                SendClientMessage(playerid, COLOR_LIGHTRED, string);
            }
        }
        return 1;
    }



Re: Car - Rayelm - 02.06.2012

change this line
pawn Код:
PutPlayerInVehicle(playerid, 424, 0);
with
pawn Код:
PutPlayerInVehicle(giveplayerid, 424, 0);



Re: Car - Edin Black - 02.06.2012

nothing happens when i type ingame the command


EDIT: So guys, with this command i will spawn a car with the "ID 424", and i want to be in it, when it spawn.


Re: Car - Rayelm - 02.06.2012

are your admin level is 3 ?


Re: Car - Yuryfury - 02.06.2012

You have to CreateVehicle first, Get the vehicle id, then do PutPlayerInVehicle(playerid,vehicleid,0).

You are confusing vehicle ids and model ids.


Re: Car - Edin Black - 02.06.2012

pawn Код:
if(strcmp(cmd, "/car", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
      tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_DGOLD, "KORISTENJE: /car [ID/DioImena]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if (PlayerInfo[playerid][pAdmin] >= 3)
            {
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                    CreateVehicle(giveplayerid, 424, 2, 2);    
                    PutPlayerInVehicle(giveplayerid, 424, 0);
                        return 1;
                    }
                }//not connected
            }
            else
            {
                format(string, sizeof(string), "ERROR: Igrac %s nije aktivan igrac. Pokusajte kasnje opet.", giveplayerid);
                SendClientMessage(playerid, COLOR_LIGHTRED, string);
            }
        }
        return 1;
    }
Is this right ?


Re: Car - Edin Black - 02.06.2012

Please can anyone help me.

When I type /car [ID/Name], dothing happens.

I give CreateCar, but 4 Warnings, problem ?

And sorry really for DP. !


Re: Car - Edin Black - 02.06.2012

I will not that the car spawn on a Cordinate: CreateVehicle(424, .....)

I go somewhere and type /car [id/name] and it spawn