Help need
#1

I have a command /towcar when i write /towcar 1 for car 1 is working but when i write /towcar 2 for car 2 is saying: UNKNOW COMMAND
PHP код:
CMD:tracteaza(playeridparams[])
{
    new 
string[144];
    new 
CARID;
    if(
GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, -1"Nu ai indeajuns bani!");
    if(
sscanf(params"u"CARID)) return SendClientMessage(playerid, -1"{FF0000}Folosire: /tracteaza [MASINA(1-2)]");
    if(
P_Data[playerid][pCar1] == && P_Data[playerid][pCar2] == 0) return SendClientMessage(playerid, -1"Nu ai masina!");
    if(
CARID 3) return 1;
    if(
CARID == 1)
    {
        if(
P_Data[playerid][pCar1] == 1)
        {
            foreach(
Playeri)
            {
                if(
IsPlayerInVehicle(imasina[playerid]) == 1) return SendClientMessage(playerid, -1"Masina in folosinta!");
            }
            
DestroyVehicle(masina[playerid]);
            
masina[playerid] = CreateVehicle(P_Data[playerid][pCarID1], P_Data[playerid][pCarX1],  P_Data[playerid][pCarY1],  P_Data[playerid][pCarZ1],  P_Data[playerid][pCarR1],  P_Data[playerid][pCarColor11],  P_Data[playerid][pCarColor21], -1);
            
P_Data[playerid][pCarKey1] = masina[playerid];
            
format(stringsizeof(string), "%s a fost tractat la locul de parcare!"VehicleNames[P_Data[playerid][pCarID1]-400]);
            
SendClientMessage(playerid, -1string);
        }
    }
    if(
CARID == 2)
    {
        if(
P_Data[playerid][pCar2] == 1)
        {
            foreach(
Playeri)
            {
                if(
IsPlayerInVehicle(imasina2[playerid]) == 1) return SendClientMessage(playerid, -1"Masina in folosinta!");
            }
            
DestroyVehicle(masina2[playerid]);
            
masina2[playerid] = CreateVehicle(P_Data[playerid][pCarID2], P_Data[playerid][pCarX2],  P_Data[playerid][pCarY2],  P_Data[playerid][pCarZ2],  P_Data[playerid][pCarR2],  P_Data[playerid][pCarColor12],  P_Data[playerid][pCarColor22], -1);
            
P_Data[playerid][pCarKey2] = masina2[playerid];
            
format(stringsizeof(string), "%s a fost tractat la locul de parcare!"VehicleNames[P_Data[playerid][pCarID2]-400]);
            
SendClientMessage(playerid, -1string);
        }
    }
    return 
1;

Reply
#2

PHP код:
if(sscanf(params"u"CARID)) 
Why there you used "u" that mean user ... use "d" or "i" for integers .
Reply
#3

The 'u' specifier detects for connected players not an integer. Use 'i' specifier instead.

From this:
pawn Код:
if(sscanf(params, "u", CARID)) return SendClientMessage(playerid, -1, "{FF0000}Folosire: /tracteaza [MASINA(1-2)]");
To this:
pawn Код:
if(sscanf(params, "i", CARID)) return SendClientMessage(playerid, -1, "{FF0000}Folosire: /tracteaza [MASINA(1-2)]");
Reply
#4

CMD:tracteaza(playerid, params[])
{
new string[144];
new CARID;
if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, -1, "Nu ai indeajuns bani!");
if(sscanf(params, "d", CARID)) return SendClientMessage(playerid, -1, "{FF0000}Folosire: /tracteaza [MASINA(1-2)]");
if(P_Data[playerid][pCar1] == 0 && P_Data[playerid][pCar2] == 0) return SendClientMessage(playerid, -1, "Nu ai masina!");
if(CARID > 3) return 1;
if(CARID == 1)
{
if(P_Data[playerid][pCar1] == 1)
{
foreach(Player, i)
{
if(IsPlayerInVehicle(i, masina[playerid]) == 1) return SendClientMessage(playerid, -1, "Masina in folosinta!");
}
DestroyVehicle(masina[playerid]);
masina[playerid] = CreateVehicle(P_Data[playerid][pCarID1], P_Data[playerid][pCarX1], P_Data[playerid][pCarY1], P_Data[playerid][pCarZ1], P_Data[playerid][pCarR1], P_Data[playerid][pCarColor11], P_Data[playerid][pCarColor21], -1);
P_Data[playerid][pCarKey1] = masina[playerid];
format(string, sizeof(string), "%s a fost tractat la locul de parcare!", VehicleNames[P_Data[playerid][pCarID1]-400]);
SendClientMessage(playerid, -1, string);
}
}
if(CARID == 2)
{
if(P_Data[playerid][pCar2] == 1)
{
foreach(Player, i)
{
if(IsPlayerInVehicle(i, masina2[playerid]) == 1) return SendClientMessage(playerid, -1, "Masina in folosinta!");
}
DestroyVehicle(masina2[playerid]);
masina2[playerid] = CreateVehicle(P_Data[playerid][pCarID2], P_Data[playerid][pCarX2], P_Data[playerid][pCarY2], P_Data[playerid][pCarZ2], P_Data[playerid][pCarR2], P_Data[playerid][pCarColor12], P_Data[playerid][pCarColor22], -1);
P_Data[playerid][pCarKey2] = masina2[playerid];
format(string, sizeof(string), "%s a fost tractat la locul de parcare!", VehicleNames[P_Data[playerid][pCarID2]-400]);
SendClientMessage(playerid, -1, string);
}
}
return 1;
}

if you used " U " in sscanf it mean id. ( playerid ) (target id )
if you used " d/i " it mean intger like 1, 2 .....etc
if you used " s " it mean sting ( text ) .
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)