Car Commands Bugging
#1

When i use this command it not appear anything did i do anything wrong?
PHP код:
CMD:car(playeridparams[])
{
    new 
car[50],color1,color2,message[75], Float:pPos[4],VehicleID;
    if(
DM[playerid] == 1) return SendClientMessage(playerid, -1,""red"[ ERROR ]: "yellow"You can't use this command while deathmatch!");
    if(
DUEL[playerid] == 1) return SendClientMessage(playerid, -1,""red"[ ERROR]: "yellow"You can't use this command while duel!");
    if(
AccInfo[playerid][Cars] != 0DestroyVehicle(AccInfo[playerid][Cars]);
    if(
sscanf(params,"s[50]D(6)D(0)",car,color1,color2)) SendClientMessage(playerid, -1""red"[ USAGE ]: "yellow"/car [ ID/CARNAME ] [Color 1] [Color 2]");
    else{
        
VehicleID GetVehicleModelIDFromName(car);
        if(
VehicleID == -1)
        {
            
VehicleID strval(car);
            if(
VehicleID 400 || VehicleID 611) return SendClientMessage(playerid, -1""red"[ ERROR ]: "yellow"You entered an invalid vehiclename!");
        }
        new 
Model ReturnVehicleID(params);
        if(
AccInfo[playerid][LesenKereta] == 0)
        {
                if(
Model == INVALID_VEHICLE_ID)
                {
                        if(
strlen(params) > 8params[8] = EOS;
                        
Model strval(params);
                        if(!(
400 <= Model <= 611))
                        return 
SendClientMessage(playerid, -1""red"[ ERROR ]: "yellow"You entered an invalid vehiclename!");
                        
GetPlayerPos(playeridpPos[0], pPos[1], pPos[2]);
                        
GetPlayerFacingAngle(playeridpPos[3]);
                        
AccInfo[playerid][Cars] = CreateVehicle(ModelpPos[0], pPos[1], pPos[2] + 1pPos[3], 0160);
                        
PutPlayerInVehicle(playeridAccInfo[playerid][Cars], 0);
                        
format(messagesizeof(message), ""red"[ UFM ]: "yellow"You have spawned %s[%d]!"GetVehicleNames(AccInfo[playerid][Cars]),VehicleID);
                        
SendClientMessage(playerid, -1message);
                }
        } else if(
AccInfo[playerid][LesenKereta] == 1){
        
GetPlayerPos(playeridpPos[0], pPos[1], pPos[2]);
        
GetPlayerFacingAngle(playeridpPos[3]);
        
AccInfo[playerid][Cars] = CreateVehicle(ModelpPos[0], pPos[1], pPos[2] + 1pPos[3], 0160);
        
PutPlayerInVehicle(playeridAccInfo[playerid][Cars], 0);
        
format(messagesizeof(message), ""red"[ UFM ]: "yellow"You have spawned %s[%d]!"GetVehicleNames(AccInfo[playerid][Cars]),VehicleID);
        
SendClientMessage(playerid, -1message);
        }
    }
    return 
1;

Reply
#2

Maybe this works..

pawn Код:
CMD:car(playerid, params[])
{
    new car[50],color1,color2,message[75], Float:pPos[4],VehicleID;
    if(DM[playerid] == 1) return SendClientMessage(playerid, -1,""red"[ ERROR ]: "yellow"You can't use this command while deathmatch!");
    if(DUEL[playerid] == 1) return SendClientMessage(playerid, -1,""red"[ ERROR]: "yellow"You can't use this command while duel!");
    if(AccInfo[playerid][Cars] != 0) DestroyVehicle(AccInfo[playerid][Cars]);
    if(sscanf(params,"s[50]D(6)D(0)",car,color1,color2)) SendClientMessage(playerid, -1, ""red"[ USAGE ]: "yellow"/car [ ID/CARNAME ] [Color 1] [Color 2]");
    else{
        VehicleID = GetVehicleModelIDFromName(car);
        if(VehicleID == -1)
        {
            VehicleID = strval(car);
            if(VehicleID < 400 || VehicleID > 611) return SendClientMessage(playerid, -1, ""red"[ ERROR ]: "yellow"You entered an invalid vehiclename!");
        }
        new Model = ReturnVehicleID(params);
        if(AccInfo[playerid][LesenKereta] == 0)
        {
                if(Model != INVALID_VEHICLE_ID)
                {
                        if(strlen(params) > 8) params[8] = EOS;
                        Model = strval(params);
                        if(!(400 <= Model <= 611))
                        return SendClientMessage(playerid, -1, ""red"[ ERROR ]: "yellow"You entered an invalid vehiclename!");
                        GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
                        GetPlayerFacingAngle(playerid, pPos[3]);
                        AccInfo[playerid][Cars] = CreateVehicle(Model, pPos[0], pPos[1], pPos[2] + 1, pPos[3], 0, 1, 60);
                        PutPlayerInVehicle(playerid, AccInfo[playerid][Cars], 0);
                        format(message, sizeof(message), ""red"[ UFM ]: "yellow"You have spawned %s[%d]!", GetVehicleNames(AccInfo[playerid][Cars]),VehicleID);
                        SendClientMessage(playerid, -1, message);
                }
        } else if(AccInfo[playerid][LesenKereta] == 1){
        GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
        GetPlayerFacingAngle(playerid, pPos[3]);
        AccInfo[playerid][Cars] = CreateVehicle(Model, pPos[0], pPos[1], pPos[2] + 1, pPos[3], 0, 1, 60);
        PutPlayerInVehicle(playerid, AccInfo[playerid][Cars], 0);
        format(message, sizeof(message), ""red"[ UFM ]: "yellow"You have spawned %s[%d]!", GetVehicleNames(AccInfo[playerid][Cars]),VehicleID);
        SendClientMessage(playerid, -1, message);
        }
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by TaiRinsuru
Посмотреть сообщение
Maybe this works..

pawn Код:
CMD:car(playerid, params[])
{
    new car[50],color1,color2,message[75], Float:pPos[4],VehicleID;
    if(DM[playerid] == 1) return SendClientMessage(playerid, -1,""red"[ ERROR ]: "yellow"You can't use this command while deathmatch!");
    if(DUEL[playerid] == 1) return SendClientMessage(playerid, -1,""red"[ ERROR]: "yellow"You can't use this command while duel!");
    if(AccInfo[playerid][Cars] != 0) DestroyVehicle(AccInfo[playerid][Cars]);
    if(sscanf(params,"s[50]D(6)D(0)",car,color1,color2)) SendClientMessage(playerid, -1, ""red"[ USAGE ]: "yellow"/car [ ID/CARNAME ] [Color 1] [Color 2]");
    else{
        VehicleID = GetVehicleModelIDFromName(car);
        if(VehicleID == -1)
        {
            VehicleID = strval(car);
            if(VehicleID < 400 || VehicleID > 611) return SendClientMessage(playerid, -1, ""red"[ ERROR ]: "yellow"You entered an invalid vehiclename!");
        }
        new Model = ReturnVehicleID(params);
        if(AccInfo[playerid][LesenKereta] == 0)
        {
                if(Model != INVALID_VEHICLE_ID)
                {
                        if(strlen(params) > 8) params[8] = EOS;
                        Model = strval(params);
                        if(!(400 <= Model <= 611))
                        return SendClientMessage(playerid, -1, ""red"[ ERROR ]: "yellow"You entered an invalid vehiclename!");
                        GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
                        GetPlayerFacingAngle(playerid, pPos[3]);
                        AccInfo[playerid][Cars] = CreateVehicle(Model, pPos[0], pPos[1], pPos[2] + 1, pPos[3], 0, 1, 60);
                        PutPlayerInVehicle(playerid, AccInfo[playerid][Cars], 0);
                        format(message, sizeof(message), ""red"[ UFM ]: "yellow"You have spawned %s[%d]!", GetVehicleNames(AccInfo[playerid][Cars]),VehicleID);
                        SendClientMessage(playerid, -1, message);
                }
        } else if(AccInfo[playerid][LesenKereta] == 1){
        GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
        GetPlayerFacingAngle(playerid, pPos[3]);
        AccInfo[playerid][Cars] = CreateVehicle(Model, pPos[0], pPos[1], pPos[2] + 1, pPos[3], 0, 1, 60);
        PutPlayerInVehicle(playerid, AccInfo[playerid][Cars], 0);
        format(message, sizeof(message), ""red"[ UFM ]: "yellow"You have spawned %s[%d]!", GetVehicleNames(AccInfo[playerid][Cars]),VehicleID);
        SendClientMessage(playerid, -1, message);
        }
    }
    return 1;
}
still not working
Reply
#4

PHP код:
CMD:car(playeridparams[])
{
    new 
car[50],color1,color2,message[75], Float:pPos[4],VehicleID;
    if(
DM[playerid] == 1) return SendClientMessage(playerid, -1,""red"[ ERROR ]: "yellow"You can't use this command while deathmatch!");
    if(
DUEL[playerid] == 1) return SendClientMessage(playerid, -1,""red"[ ERROR]: "yellow"You can't use this command while duel!");
    if(
AccInfo[playerid][Cars] != 0DestroyVehicle(AccInfo[playerid][Cars]);
    if(
sscanf(params,"s[50]D(6)D(0)",car,color1,color2)) SendClientMessage(playerid, -1""red"[ USAGE ]: "yellow"/car [ ID/CARNAME ] [Color 1] [Color 2]");
    else{
        
VehicleID GetVehicleModelIDFromName(car);
        if(
VehicleID == -1)
        {
            
VehicleID strval(car);
            if(
VehicleID 400 || VehicleID 611) return SendClientMessage(playerid, -1""red"[ ERROR ]: "yellow"You entered an invalid vehiclename!");
        }
        new 
Model ReturnVehicleID(params);
        if(
AccInfo[playerid][LesenKereta] == 0)
        {
                if(
Model == INVALID_VEHICLE_ID)
                {
                        if(
strlen(params) > 8params[8] = EOS;
                        
Model strval(params);
                        if(!(
400 <= Model <= 611))
                        return 
SendClientMessage(playerid, -1""red"[ ERROR ]: "yellow"You entered an invalid vehiclename!");
                        
GetPlayerPos(playeridpPos[0], pPos[1], pPos[2]);
                        
GetPlayerFacingAngle(playeridpPos[3]);
                        
AccInfo[playerid][Cars] = CreateVehicle(ModelpPos[0], pPos[1], pPos[2] + 1pPos[3], 0160);
                        
PutPlayerInVehicle(playeridAccInfo[playerid][Cars], 0);
                        
format(messagesizeof(message), ""red"[ UFM ]: "yellow"You have spawned %s[%d]!"GetVehicleNames(AccInfo[playerid][Cars]),VehicleID);
                        
SendClientMessage(playerid, -1message);
                }
        } else{
        
GetPlayerPos(playeridpPos[0], pPos[1], pPos[2]);
        
GetPlayerFacingAngle(playeridpPos[3]);
        
AccInfo[playerid][Cars] = CreateVehicle(ModelpPos[0], pPos[1], pPos[2] + 1pPos[3], 0160);
        
PutPlayerInVehicle(playeridAccInfo[playerid][Cars], 0);
        
format(messagesizeof(message), ""red"[ UFM ]: "yellow"You have spawned %s[%d]!"GetVehicleNames(AccInfo[playerid][Cars]),VehicleID);
        
SendClientMessage(playerid, -1message);
        }
    }
    return 
1;

Reply
#5

Quote:
Originally Posted by FuNkYTheGreat
Посмотреть сообщение
PHP код:
CMD:car(playeridparams[])
{
    new 
car[50],color1,color2,message[75], Float:pPos[4],VehicleID;
    if(
DM[playerid] == 1) return SendClientMessage(playerid, -1,""red"[ ERROR ]: "yellow"You can't use this command while deathmatch!");
    if(
DUEL[playerid] == 1) return SendClientMessage(playerid, -1,""red"[ ERROR]: "yellow"You can't use this command while duel!");
    if(
AccInfo[playerid][Cars] != 0DestroyVehicle(AccInfo[playerid][Cars]);
    if(
sscanf(params,"s[50]D(6)D(0)",car,color1,color2)) SendClientMessage(playerid, -1""red"[ USAGE ]: "yellow"/car [ ID/CARNAME ] [Color 1] [Color 2]");
    else{
        
VehicleID GetVehicleModelIDFromName(car);
        if(
VehicleID == -1)
        {
            
VehicleID strval(car);
            if(
VehicleID 400 || VehicleID 611) return SendClientMessage(playerid, -1""red"[ ERROR ]: "yellow"You entered an invalid vehiclename!");
        }
        new 
Model ReturnVehicleID(params);
        if(
AccInfo[playerid][LesenKereta] == 0)
        {
                if(
Model == INVALID_VEHICLE_ID)
                {
                        if(
strlen(params) > 8params[8] = EOS;
                        
Model strval(params);
                        if(!(
400 <= Model <= 611))
                        return 
SendClientMessage(playerid, -1""red"[ ERROR ]: "yellow"You entered an invalid vehiclename!");
                        
GetPlayerPos(playeridpPos[0], pPos[1], pPos[2]);
                        
GetPlayerFacingAngle(playeridpPos[3]);
                        
AccInfo[playerid][Cars] = CreateVehicle(ModelpPos[0], pPos[1], pPos[2] + 1pPos[3], 0160);
                        
PutPlayerInVehicle(playeridAccInfo[playerid][Cars], 0);
                        
format(messagesizeof(message), ""red"[ UFM ]: "yellow"You have spawned %s[%d]!"GetVehicleNames(AccInfo[playerid][Cars]),VehicleID);
                        
SendClientMessage(playerid, -1message);
                }
        } else{
        
GetPlayerPos(playeridpPos[0], pPos[1], pPos[2]);
        
GetPlayerFacingAngle(playeridpPos[3]);
        
AccInfo[playerid][Cars] = CreateVehicle(ModelpPos[0], pPos[1], pPos[2] + 1pPos[3], 0160);
        
PutPlayerInVehicle(playeridAccInfo[playerid][Cars], 0);
        
format(messagesizeof(message), ""red"[ UFM ]: "yellow"You have spawned %s[%d]!"GetVehicleNames(AccInfo[playerid][Cars]),VehicleID);
        
SendClientMessage(playerid, -1message);
        }
    }
    return 
1;

Why I Can't use the license
Reply
#6

hmm ?
Reply
#7

Try it simple :car cmd
Quote:

CMD:car(playerid,params[]) {
if( PlayerInfo[playerid][Level] >= 2 || PlayerInfo[playerid][Vip] >= 1) {
new tmp[128], tmp2[128], tmp3[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); tmp3 = strtok(params,Index);
if(isnull(tmp)) return SendClientMessage(playerid, red, "USAGE: /car [Modelid/Name] [colour1] [colour2]");
new car, colour1, colour2, string[128];
if(!IsNumeric(tmp)) car = GetVehicleModelIDFromName(tmp); else car = strval(tmp);
if(car < 400 || car > 611) return SendClientMessage(playerid, red, "ERROR: Invalid Vehicle Model");
if(isnull(tmp2)) colour1 = random(126); else colour1 = strval(tmp2);
if(isnull(tmp3)) colour2 = random(126); else colour2 = strval(tmp3);
new LVehicleID,Float:X,Float:Y,Float:Z, Float:Angle,int1; GetPlayerPos(playerid, X,Y,Z); GetPlayerFacingAngle(playerid,Angle); int1 = GetPlayerInterior(playerid);
LVehicleID = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1); LinkVehicleToInterior(LVehicleID,int1);
CMDMessageToAdmins(playerid,"CAR");
format(string, sizeof(string), "%s spawned a \"%s\" (Model:%d) colour (%d, %d), at %0.2f, %0.2f, %0.2f", pName(playerid), VehicleName[car-400], car, colour1, colour2, X, Y, Z);
SaveToFile("CarSpawns",string);
format(string, sizeof(string), "You have spawned a \"%s\" (Model:%d) colour (%d, %d)", VehicleName[car-400], car, colour1, colour2);
PutPlayerInVehicle(playerid, LVehicleID, 0);
VehicleInfo[LVehicleID][Temp] = 1;
return SendClientMessage(playerid,lightblue, string);
} else return SendClientMessage(playerid,red,"ERROR: You need to be level 3 to use this command");
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)