Helping with the command
#1

Hey there, well i was trying to make a command with 2 functions , now heres the thing
the command unimpounds a vehicle the thing is that i cant make it like i want.

If a player types for example /unimpound 3 it will unimpound vehicle id 3 , i've arrived till here i mean i made it to unimpound the vehicle 3 but the other thing is
if a player types /unimpound it will show the dialog which i made

now the problem is that i dont know how to show the dialog if the player hasn't writen any id
and if he writes one it unimpounds the writen id


Код:
        else if(!strcmp(tmp, "unimpound", true, 7))
        {
		   if(PlayerInfo[playerid][playerteam] != FAC_TYPE_POLICE && PlayerInfo[playerid][ranklvl] <=2)
            {
               if(!strlen(tmp2) || !IsNumeric(tmp2)) return SCP(playerid, "car unimpound [ ID ]");
			   {
				new theunimpoundid = strval(tmp2);
                  if(!dini_Isset(globalstats, "unimpoundslot"))
            dini_IntSet(globalstats, "unimpoundslot", 0);
            new ri = dini_Int(globalstats, "unimpoundslot");
            if(ri >= sizeof(unimpoundpos))
            {
                ri = 0;
                dini_IntSet(globalstats, "unimpoundslot", 0);
            }
            else dini_IntSet(globalstats, "unimpoundslot", ri+1);
            VehicleInfo[theunimpoundid][vX] = unimpoundpos[ri][spawnx];
            VehicleInfo[theunimpoundid][vY] = unimpoundpos[ri][spawny];
            VehicleInfo[theunimpoundid][vZ] = unimpoundpos[ri][spawnz];
            VehicleInfo[theunimpoundid][vA] = unimpoundpos[ri][sangle];
            VehicleInfo[theunimpoundid][vVirtualWorld] = 0;
            VehicleInfo[theunimpoundid][vImpounded] = 0;
            VehicleInfo[theunimpoundid][vImpoundFee] = 0;
            myStrcpy(VehicleInfo[theunimpoundid][vImpoundReason], "None");
            ReloadVehicle(theunimpoundid);
            printf("%d",theunimpoundid);
			   }
            }
            else
            {
             new iBigStr[1575], iCount, iSmllStr[128];
            strcat(iBigStr, "Vehicle\tImpound fee\tImpound Reason\n");
            VehicleLoop(v)
            {
                if(VehicleInfo[v][vActive] != true) continue;
                if(strcmp(PlayerName(playerid), VehicleInfo[v][vOwner], false)) continue;
                if(VehicleInfo[v][vImpounded] != 1) continue;
                if(VehicleInfo[v][vImpounded] == 1 && VehicleInfo[v][vSpawned] != true)
                {
                    iCount++;
                    format(iSmllStr, sizeof(iSmllStr), "%d %s(%d)\t%d\t%s\n", v, GetVehicleNameFromModel(VehicleInfo[v][vModel]),VehicleInfo[v][rID],VehicleInfo[v][vImpoundFee], VehicleInfo[v][vImpoundReason]);
                }
                strcat(iBigStr, iSmllStr);
                ShowPlayerDialog(playerid, DIALOG_UNIMPOUND, DIALOG_STYLE_TABLIST_HEADERS, "{3196ef}Please select vehicle you would like to unimpound", iBigStr, "Select", "Exit");
            }
            if(!iCount) return SendClientError(playerid, "You don't have any impounded vehicle");
            return 1;
            }
  }
Reply
#2

I can't believe in 2017 there is someone who doesn't use sscanf.
Man, use sscanf and zcmd
Reply
#3

Im already using the zcmd and sscanf lol
The command is car unimpound but there are more cmds in car cmd so
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)