Jump to content

Question

Posted (edited)

Salut.Am o problema la la /vipname am serverul meu propiu< imi fac vehiculul vip si cand ii dau /vipname imi spune Poti folosi aceasta comanda doar pe vehicule VIP.

Poate am gresit cu ceva la Comanda ! Uitati

 

CMD:vipname(playerid, params[])
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER && GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SCM(playerid, COLOR_WHITE, "Nu esti intr-un vehicul.");
    new vehicleid = GetPlayerVehicleID(playerid);
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[IsAnOwnableCar(vehicleid)][pUpgrade] == 0)
        {
            new query[256],text[20],test[20];
            if(sscanf(params, "s[20]", text)) return SCM(playerid, COLOR_WHITE, "{FF0000}Usage: {FFFFFF}/vipname [Text]");
            if(strlen(text) > 20) return SendClientMessage(playerid, COLOR_WHITE, "Maximum 20 characters are allowed.");
               if(strlen(text) == 0) return 1;
            SetVipText(playerid, vehicleid);
            mysql_real_escape_string(text, test);
            mysql_format(SQL, query, sizeof(query), "UPDATE `cars` SET `Vip`='%s' WHERE `ID`='%d'", test, CarInfo[IsAnOwnableCar(vehicleid)]);
            mysql_tquery(SQL, query, "", "");
            format(query, sizeof(query), "Text pentru vehicul setat: %s", text);
            SendClientMessage(playerid, COLOR_ADMCOMMANDS, query);
        }
        else return SCM(playerid, COLOR_WHITE, "Poti folosi aceasta comanda doar pe vehicule VIP.");
    }
    return 1;
}

Edited by andreyctn

9 answers to this question

Recommended Posts

  • 0
Posted

if(PlayerInfo[IsAnOwnableCar(vehicleid)][pUpgrade] == 0)

Asta arata ca doar daca nu ai VIP adica daca ai '0' poti da /vipname

Modifica if(PlayerInfo[IsAnOwnableCar(vehicleid)][pUpgrade] == 0) cu if(PlayerInfo[IsAnOwnableCar(vehicleid)][pUpgrade] == 1) si iti va merge sigur

  • 0
Posted
La 19.02.2018 la 22:01, andreyctn a spus:

Nu merge.

poate trebuie sa bag ceva aici ?

 

mysql_tquery(SQL, query, "? ", "?");

Nu are legatura cu query-ul. Totul tine de verificarea  if(PlayerInfo[IsAnOwnableCar(vehicleid)][pUpgrade] == 0). care ar trebui sa fie asa  if(PlayerInfo[IsAnOwnableCar(vehicleid)][pUpgrade] == 1). Daca nu merge fa un debug cand faci masina vip si unul cand folosesti comanda vipname. (debugul il faci afisand un mesaj pt jucator cu valoarea variabilei pUpgrade)

  • 0
Posted

Incerca asa

CMD:vipname(playerid, params[])
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER && GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SCM(playerid, COLOR_WHITE, "Nu esti intr-un vehicul.");
    new vehicleid = GetPlayerVehicleID(playerid);

    if(!IsPlayerConnected(playerid)) return SCM(playerid, COLOR_WHITE, "Nu esti conectat");
    if(PlayerInfo[IsAnOwnableCar(vehicleid)][pUpgrade] == 0) return SCM(playerid, COLOR_WHITE, "Poti folosi aceasta comanda doar pe vehicule VIP.");

    new query[256],text[20],test[20];
    if(sscanf(params, "s[20]", text)) return SCM(playerid, COLOR_WHITE, "{FF0000}Usage: {FFFFFF}/vipname [Text]");
    if(strlen(text) < 1 || text(title) > 20) return SCM(playerid, COLOR_GREY, "Minim 1 caracte maxim 20");
    
    SetVipText(playerid, vehicleid);
    mysql_real_escape_string(text, test);
    mysql_format(SQL, query, sizeof(query), "UPDATE `cars` SET `Vip`='%s' WHERE `ID`='%d'", test, CarInfo[IsAnOwnableCar(vehicleid)]);
    mysql_tquery(SQL, query, "", "");
    format(query, sizeof(query), "Text pentru vehicul setat: %s", text);
    SendClientMessage(playerid, COLOR_ADMCOMMANDS, query);
    return 1;
}

 

  • 0
Posted
La 22/2/2018 la 14:48, MiritaXD a spus:

Incerca asa


CMD:vipname(playerid, params[])
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER && GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SCM(playerid, COLOR_WHITE, "Nu esti intr-un vehicul.");
    new vehicleid = GetPlayerVehicleID(playerid);

    if(!IsPlayerConnected(playerid)) return SCM(playerid, COLOR_WHITE, "Nu esti conectat");
    if(PlayerInfo[IsAnOwnableCar(vehicleid)][pUpgrade] == 0) return SCM(playerid, COLOR_WHITE, "Poti folosi aceasta comanda doar pe vehicule VIP.");

    new query[256],text[20],test[20];
    if(sscanf(params, "s[20]", text)) return SCM(playerid, COLOR_WHITE, "{FF0000}Usage: {FFFFFF}/vipname [Text]");
    if(strlen(text) < 1 || text(title) > 20) return SCM(playerid, COLOR_GREY, "Minim 1 caracte maxim 20");
    
    SetVipText(playerid, vehicleid);
    mysql_real_escape_string(text, test);
    mysql_format(SQL, query, sizeof(query), "UPDATE `cars` SET `Vip`='%s' WHERE `ID`='%d'", test, CarInfo[IsAnOwnableCar(vehicleid)]);
    mysql_tquery(SQL, query, "", "");
    format(query, sizeof(query), "Text pentru vehicul setat: %s", text);
    SendClientMessage(playerid, COLOR_ADMCOMMANDS, query);
    return 1;
}

 

C:\Users\Utente\Desktop\Gamemode AngelZone\gamemodes\VLM.pwn(40240) : error 012: invalid function call, not a valid address
C:\Users\Utente\Desktop\Gamemode AngelZone\gamemodes\VLM.pwn(40240) : error 017: undefined symbol "title"
C:\Users\Utente\Desktop\Gamemode AngelZone\gamemodes\VLM.pwn(40240) : error 029: invalid expression, assumed zero
C:\Users\Utente\Desktop\Gamemode AngelZone\gamemodes\VLM.pwn(40240) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.


Pfff numai probleme sami bag ceva fratilor.

 

  • 0
Posted
@andreyctn
CMD:vipname(playerid, params[])
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER && GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SCM(playerid, COLOR_WHITE, "Nu esti intr-un vehicul.");
    new vehicleid = GetPlayerVehicleID(playerid);

    if(!IsPlayerConnected(playerid)) return SCM(playerid, COLOR_WHITE, "Nu esti conectat");
    if(PlayerInfo[IsAnOwnableCar(vehicleid)][pUpgrade] == 0) return SCM(playerid, COLOR_WHITE, "Poti folosi aceasta comanda doar pe vehicule VIP.");

    new query[256],text[20],test[20];
    if(sscanf(params, "s[20]", text)) return SCM(playerid, COLOR_WHITE, "{FF0000}Usage: {FFFFFF}/vipname [Text]");
    if(strlen(text) < 1 || text(text) > 20) return SCM(playerid, COLOR_GREY, "Minim 1 caracte maxim 20");
    
    SetVipText(playerid, vehicleid);
    mysql_real_escape_string(text, test);
    mysql_format(SQL, query, sizeof(query), "UPDATE `cars` SET `Vip`='%s' WHERE `ID`='%d'", test, CarInfo[IsAnOwnableCar(vehicleid)]);
    mysql_tquery(SQL, query, "", "");
    format(query, sizeof(query), "Text pentru vehicul setat: %s", text);
    SendClientMessage(playerid, COLOR_ADMCOMMANDS, query);
    return 1;
}
  • 0
Posted

de ce folosesti asta 

if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER && GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SCM(playerid, COLOR_WHITE, "Nu esti intr-un vehicul.");

 

cand este exact acelasi lucru cu asta 

if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SCM(playerid, ........ )

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.