/towcar command not working...
#1

Hi guys and girls,

I have recently began rescripting my "assistance" job class section for my server, and have come accross a problem, i cannot get my /towcar command to work, it executes (because it doesnt say "SERVER: Unknown Command"), however it doesnt attach the car to the tow truck, can someone help?

Here is the "assistance" section of my OnPlayerCommandText callback:

pawn Код:
//Assistance...
    new Float:A_x, Float:A_y, Float:A_z;
    new A_Vehicle;
    if(strcmp("/assistance", cmdtext) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid) == 1)
        {
            SendClientMessage(playerid, WORK, "Assistance has been called");
            SendClientMessage(playerid, WORK, "Just sit back, and wait!");
            //Call Assistance
            A_Vehicle = GetPlayerVehicleID(playerid);
            GetVehiclePos(A_Vehicle, A_x, A_y, A_z);
            new AssistanceMessage[128], PlayersName[128];
            GetPlayerName(playerid, PlayersName, sizeof(PlayersName));
            format(AssistanceMessage, sizeof(AssistanceMessage), "%s needs assistance, go and help!", PlayersName);
            for(new i; i < MAX_PLAYERS; i++)
            {
                if(GetPlayerTeam(i) == 2)
                {
                    SendClientMessage(i, WORK, AssistanceMessage);
                    SetPlayerCheckpoint(i, A_x, A_y, A_z, 15);
                }
            }
        }
        return 1;
    }

    if(strcmp("/repaircar", cmdtext) == 0)
    {
        if(GetPlayerTeam(playerid) == 2)
        {
            if(IsPlayerInRangeOfPoint(playerid, 15, A_x, A_y, A_z) == 1)
            {
                RepairVehicle(A_Vehicle);
                SetVehicleHealth(A_Vehicle, 100.0);
            }
        }
        return 1;
    }
   
    if(strcmp("/towcar", cmdtext) == 0)
    {
        if(GetPlayerTeam(playerid) == 2)
        {
            if(IsPlayerInRangeOfPoint(playerid, 15, A_x, A_y, A_z) == 1)
            {
                AttachTrailerToVehicle(A_Vehicle, GetPlayerVehicleID(playerid));
            }
        }
        return 1;
    }
    //------------------------------------------
I dont see whats wrong, unless its my A_Vehicle thing,
Can anyone else see the problem?

Thanks
Ash
Reply
#2

try without GetPlayerTeam...

if(strcmp("/towcar", cmdtext) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, 15, A_x, A_y, A_z) == 1)
{
AttachTrailerToVehicle(A_Vehicle, GetPlayerVehicleID(playerid));
}
else { SendClientMessage(playerid,color,"BLABLA"); }
return 1;
}

if it sends a message BLABLA.. then u are not near the point... if that worked try it with the GetPlayerTeam.

if it didnt work... there might be a problem from your previous commands
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)