error on a command
#1

so this is a command from my gamemode



that thing that if i type /crear desarmador 0

my id = 0

it will just say that "el Jugador no esta cerca tuyo" which means "The player is not close to you"
pawn Код:
CMD:crear(playerid, params[])
{
    if (Info[playerid][pJob] != 14 && Info[playerid][pJob2] != 14) return SendClientMessageEx(playerid,COLOR_GREY,"No eres un Artesando!");
    if (Info[playerid][pJailTime] > 0) return SendClientMessageEx(playerid,COLOR_GREY,"No puedes hacer esto en la prisiуn!");
    new string[128];
    if (GetPVarInt(playerid, "ArmsTimer") > 0)
    {
        format(string, sizeof(string), "Debes esperar %d segundo despuйs de haber fabricado algo.", GetPVarInt(playerid, "ArmsTimer"));
        SendClientMessageEx(playerid,COLOR_GREY,string);
        return 1;
    }
    //if(Info[playerid][pScrewdriver] == 0) return SendClientMessageEx(playerid, COLOR_WHITE, "No tienes desarmadores.");
    if(GetPVarInt(playerid,"Injured") == 1) return SendClientMessageEx(playerid, COLOR_GREY, "No puedes hacer esto mientras estбs herido.");
    new giveplayerid, choice[32], weapon, price;
    if(sscanf(params, "us[32]", giveplayerid, choice))
    {
        SendClientMessageEx(playerid, COLOR_GREEN, "________________________________________________");
        SendClientMessageEx(playerid, COLOR_YELLOW, "<< Nombres Disponibles >>");
        SendClientMessageEx(playerid, COLOR_GRAD1, "Desarmador(1000)     Camara(8000)");
        SendClientMessageEx(playerid, COLOR_GRAD1, "HPSave(4000)     Paracaнdas(50)");
        SendClientMessageEx(playerid, COLOR_GREEN, "________________________________________________");
        SendClientMessageEx(playerid, COLOR_WHITE, "Uso: /crear [player] [nombre]");
        return 1;
    }
    if(strcmp(choice,"desarmador",true) == 0){
        if(Info[playerid][pMats] >= 1000){
            price = 1000;
            weapon = 1;
        }
        else return SendClientMessageEx(playerid,COLOR_GREY,"No tienes suficientes materiales para crear esto!");
    }
    else if(strcmp(choice,"camara",true) == 0){
        if(Info[playerid][pMats] >= 8000){
            price = 8000;
            weapon = 2;
        }
        else return SendClientMessageEx(playerid,COLOR_GREY,"No tienes suficientes materiales para crear esto!");
    }
    else if(strcmp(choice,"hpsave",true) == 0){
        if(Info[playerid][pMats] >= 4000){
            price = 1000;
            weapon = 3;
        }
        else return SendClientMessageEx(playerid,COLOR_GREY,"No tienes suficientes materiales para crear esto!");
    }
    else if(strcmp(choice,"paracaidas",true) == 0){
        if(Info[playerid][pMats] >= 50){
            price = 50;
            weapon = 4;
        }
        else return SendClientMessageEx(playerid,COLOR_GREY,"   Not enough Materials for that!");
    }
    else { SendClientMessageEx(playerid,COLOR_GREY,"Nombre invбlido!"); return 1; }
    if (ProxDetectorS(5.0, playerid, giveplayerid)){
        if(giveplayerid == playerid){
            format(string, sizeof(string), "Te has dado un %s.", choice);
            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
            SendClientMessageEx(playerid, COLOR_GRAD1, string);
            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
        }
        switch( Info[playerid][pSex] ){
            case 1: format(string, sizeof(string), "* %s crea algo de materiales y se lo da a йl mismo.", GetPlayerNameEx(playerid));
            default: format(string, sizeof(string), "* %s crea algo de materiales y se lo da a ella misma.", GetPlayerNameEx(playerid));
        }
        switch(weapon){
            case 1:{
                Info[playerid][pScrewdriver]++;
                return SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, "/creararma");
            }
            case 2:{
                Info[playerid][pSurveillance]++;
                return SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, "/ponercam /quitarcam /vercam");
            }
            case 3:{
                Info[playerid][pFirstaid]++;
                return SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, "/hpsave");
            }
            case 4:{
                return GivePlayerValidWeapon(playerid, 46);
            }
        }
        format(string, sizeof(string), "* Has ofrecido a %s una %s.", GetPlayerNameEx(giveplayerid), choice);
        SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "* Artesano %s quiere venderte una %s. (Usa /aceptar objeto para recibirlo)", GetPlayerNameEx(playerid), choice);
        SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
        CraftOffer[giveplayerid] = playerid;
        CraftId[giveplayerid] = weapon;
        CraftMats[giveplayerid] = price;
        format(CraftName[giveplayerid], 50, "%s", choice);
    }
    else SendClientMessageEx(playerid, COLOR_GREY, "Ese jugador no estб cerca tuyo.");
    return 1;
}
Can someone help please
Reply
#2

pawn Код:
if(giveplayerid == playerid){
            format(string, sizeof(string), "Te has dado un %s.", choice);
            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
            SendClientMessageEx(playerid, COLOR_GRAD1, string);
            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
        }
Move this part before start of ProxDetectorS condition
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)