Call Car Script Help!
#1

Well, I'm working on making a script to where when you do /rcar, it brings your specific car ID to you. I was thinking you could do the script below. (Just a start) But I'm not sure how to make it to where it brings only a certain car ID for a certain name. Could someone help me? It'd be greatly appreciated! (And yes, I am new-ish to scripting)
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    {
    if (strcmp("/rcar", cmdtext, true, 10) == 0)
    {
    if(strcmp(PlayerName,"Tyler[DGZ]",true)) {
    }
    return 1;
Reply
#2

If I'm not misunderstood... For example, you put /RCAR 1 and brings the car with the ID 1 to your location?
Reply
#3

Not that, I want it to where let's say I do /rcar. I want it to bring car ID ONE to me. Thats why I added the name checker, so it only brings a certain car for a certain name.
Reply
#4

OK. I will make it. Wait 20 minutes.
Reply
#5

Sweet!
Reply
#6

Here you have:
pawn Код:
if (strcmp("/rcar", cmdtext, true, 10) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new Name[MAX_PLAYER_NAME];
            GetPlayerName(playerid,Name,sizeof(Name));
            if(!strcmp(Name, "Tyler[DGZ]", true)) //Check the Player Name
            {
                new Float:X, Float:Y, Float:Z;
                GetPlayerPos(playerid, X, Y, Z);
                SetVehiclePos(1, X, Y, Z); //1 = vehicleid. || X = Position X || Y = Position Y || Z = Position Z.
                PutPlayerInVehicle(playerid, 1, 0); //1 = vehicleid || 0 = State(0 = Driver)
            }
            else
            {
                SendClientMessage(playerid,-1,"You can't use this command!");
                return 1;
            }
        }
        return 1;
    }
Reply
#7

Not compiling for me.. >.<
Reply
#8

What's the error?
It must look like here:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    //Command Start Here
    if (strcmp("/rcar", cmdtext, true, 10) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new Name[MAX_PLAYER_NAME];
            GetPlayerName(playerid,Name,sizeof(Name));
            if(!strcmp(Name, "Tyler[DGZ]", true)) //Check the Player Name
            {
                new Float:X, Float:Y, Float:Z;
                GetPlayerPos(playerid, X, Y, Z);
                SetVehiclePos(1, X, Y, Z); //1 = vehicleid. || X = Position X || Y = Position Y || Z = Position Z.
                PutPlayerInVehicle(playerid, 1, 0); //1 = vehicleid || 0 = State(0 = Driver)
            }
            else
            {
                SendClientMessage(playerid,-1,"You can't use this command!");
                return 1;
            }
        }
        return 1;
    }
    //Command Finish Here
    return 0;
}
Reply
#9

Okay, fixed the errors, I added it to my server.cfg, and the command /rcar isnt working.
Reply
#10

Try to do as I told you above, and if you can't, send me a private message with your MSN.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)