SA-MP Forums Archive
A little problem with one command - 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: A little problem with one command (/showthread.php?tid=436529)



A little problem with one command - benjaminjones - 11.05.2013

pawn Код:
if(strcmp(cmd, "/starttrash", true) == 0)
    {
        if(!(GetPlayerJob(playerid, 11))) return ErrorMessage(playerid, "You are not a trashman.");
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 408)
            {
                if(GetPVarInt(playerid, "StartedTrash") == 0)
                {
                    if (GetPlayerVehicleSeat(playerid) != 0) return ErrorMessage(playerid, "You must be the driver of the vehicle.");
                    for (new i = 0; i < MAX_PLAYERS; i ++)
                    {
                        if (GarbageTruck[i] == GetPlayerVehicleID(playerid))
                        {
                            SendClientMessage(playerid, GREY, "Somebody is already working with this truck.");
                            return 1;
                        }
                    }
                    SendClientMessage(playerid, YELLOW, "You've started the trashman job. Find some garbage bags around the area and load them into your truck.");
                    SendClientMessage(playerid, YELLOW, "Simply exit the vehicle and run through the garbage bag. Go to the back of the truck and press Y to load it.");
                    SendClientMessage(playerid, YELLOW, "When you're finished, go to the dump and type /unloadtrash at the yellow icon to receive your paycheck.");
                    SendClientMessage(playerid, YELLOW, "If you ever get tired of working, type /stoptrash.");
                    SetPVarInt(playerid, "StartedTrash", 1);
                    SetPlayerCheckpoint(playerid, 2233.1540, -1645.8969, 15.4857, 1.0);
                    GarbageTruck[playerid] = GetPlayerVehicleID(playerid);
                    return 1;
                }
                else return ErrorMessage(playerid, "You are already doing the trash job! Use /stoptrash to stop the job.");
            }
            else return ErrorMessage(playerid, "You can only work in a trashmaster.");
        }
        else { ErrorMessage(playerid, "You aren't in a vehicle."); }
        return 1;
    }
Alright That's the command.It says when I get the trash to go to the checkpoint and press ''Y'' but when I do this, nothing happen.I dont know why? Can someone help me please?


Re: A little problem with one command - DiGiTaL_AnGeL - 11.05.2013

OnPlayerKeyStateChange?


Re: A little problem with one command - Excelize - 11.05.2013

You need to imput OnPlayerKeyStateChange otherwise you won't be able to.