Help with errors and a question
#1

Ok im trying to make this event system but i want to set it so when the admin sets the weapon they can either enter the weapon id or the name so this is my coding
PHP код:
  new weapid,wname[50],wep,weap;
            if(
sscanf(params"s[8]ii"optionwepweap)) return SendClientMessage(playeriderror"Usage: /eedit weapon [slot] [weaponid]");
            if(
wep || wep 3) return SendClientMessage(playeriderror"Weapon slots are between 1 and 3.");
            if(
IsNumeric(weap)) weapid strval(weap); // this line has an error
            
else weapid GetWeaponID(weap);// and this line as well has an error
            
if(weap || weap 46) return SendClientMessage(playeriderror"Invalid weapon ID/Name between [1-46]");
              
GetWeaponName(weapidwnamesizeof(wname));
            switch(
wep)
            {
                case 
1EventWep[0] = weapid;
                case 
2EventWep[1] = weapid;
                case 
3EventWep[2] = weapid;
            }
            
format(stringsizeof(string), " You have set weapon slot %d to %s."wepwname);
            
SendClientMessage(playerid, -1string);
        } 
But i keep getting errors on two lines...

PHP код:
C:\Users\Andre'\Desktop\Andre'\samp\gamemodes\ODA.pwn(4247) : error 035argument type mismatch (argument 1)
C:\Users\Andre'\Desktop\Andre'\samp\gamemodes\ODA.pwn(4247) : error 035argument type mismatch (argument 1)
C:\Users\Andre'\Desktop\Andre'\samp\gamemodes\ODA.pwn(4248) : error 035argument type mismatch (argument 1)
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
3 Errors

Also could someone show me how to read a specific line with y_ini?
Reply
#2

There's a custom specifier already for weapons in sscanf (latest), use 'k<weapon>'.
Код:
new wname[50],wep,weap; 
if(sscanf(params, "s[8]ik<weapon>", option, wep, weap)) 
	return SendClientMessage(playerid, error, "Usage: /eedit weapon [slot] [weaponid]"); 
if(wep < 1 || wep > 3)
	return SendClientMessage(playerid, error, "Weapon slots are between 1 and 3."); 

if(weap < 1 || weap > 46)
	return SendClientMessage(playerid, error, "Invalid weapon ID/Name between [1-46]"); 

GetWeaponName(weap, wname, sizeof(wname)); 
EventWep[wep - 1] = weap;
format(string, sizeof(string), " You have set weapon slot %d to %s.", wep, wname); 
SendClientMessage(playerid, -1, string);
https://sampforum.blast.hk/showthread.php?tid=570927
Reply
#3

Weap is already an integer. Strval converts 'string' to integer. So that line does'nt make sense. You can delete it.
And in the other line, you used a function that gets weapon's name from a string. But you used an integer variable.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)