CMD Proplem !!
#4

Quote:
Originally Posted by IgorLuiz
Посмотреть сообщение
PHP код:
CMD:park(playerid,params[])
{
    new 
playerstates GetPlayerState(playerid);
    new 
Float:xFloat:yFloat:zFloat:rot;
    if(
playerstates == PLAYER_STATE_DRIVER)
    {
        new 
storedid GetPlayerVehicleID(playerid);
        for(new 
i=0;i<MAX_PCARS;i++)
        {
            if(
storedid == PlayerVehicles[playerid][i][pCarID])
            {
                
GetVehiclePos(storedidxyz);
                
GetVehicleZAngle(storedidarot);
                
PlayerVehicles[playerid][i][pCarX] = x;
                
PlayerVehicles[playerid][i][pCarY] = y;
                
PlayerVehicles[playerid][i][pCarZ] = z;
                
PlayerVehicles[playerid][i][pCarRot] = arot;
                
SendClientMessage(playeridCOLOR_GREEN"You successfully parked the car in your location!");
                return 
1;
            }
        }
        
SendClientMessage(playeridCOLOR_RED"This is not your car!");
    }
    else
    {
        
SendClientMessage(playeridCOLOR_RED"You must be the driver of the car!");
        return 
1;
    }
    return 
1;

You basically did nothing, but remove the variable "arot", call it "rot", and still use it as "arot".

pawn Код:
CMD:park(playerid,params[])
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new vehicleid = GetPlayerVehicleID(playerid), bool:found = false;
        for(new i = 0; i < MAX_PCARS; i ++)
        {
            if(PlayerVehicles[playerid][i][pCarID] == vehicleid)
            {
                new Float:x, Float:y, Float:z, Float:rot;
                GetVehiclePos(vehicleid, x, y, z);
                GetVehicleZAngle(vehicleid, rot);

                PlayerVehicles[playerid][i][pCarX] = x;
                PlayerVehicles[playerid][i][pCarY] = y;
                PlayerVehicles[playerid][i][pCarZ] = z;
                PlayerVehicles[playerid][i][pCarRot] = rot;

                SendClientMessage(playerid, COLOR_GREEN, "You successfully parked your car at your location.");
               
                found = true;
                break;
            }
        }

        if(!found)
        {
            SendClientMessage(playerid, COLOR_RED, "This is not your car.");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You must be the driver of the car.");
    }
    return 1;
}
Reply


Messages In This Thread
CMD Proplem !! - by Remy0 - 11.08.2015, 02:04
Re: CMD Proplem !! - by Andy5 - 11.08.2015, 02:36
Re: CMD Proplem !! - by IgorLuiz - 11.08.2015, 02:40
Re: CMD Proplem !! - by SickAttack - 11.08.2015, 03:55
Re: CMD Proplem !! - by IgorLuiz - 11.08.2015, 04:00
Re: CMD Proplem !! - by SickAttack - 11.08.2015, 04:08
Re: CMD Proplem !! - by XBrianX - 11.08.2015, 10:44

Forum Jump:


Users browsing this thread: 2 Guest(s)