SA-MP Forums Archive
What's wrong with this code? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What's wrong with this code? (/showthread.php?tid=387999)



What's wrong with this code? - Brandlax - 27.10.2012

I'm trying to store a player's information when they send someone a duel request, but keep getting the error "Argument Type Mismatch (Argument 1)". My code:

Код:
new id[128],amount[128], weapon1[123], weapon2[123], weapon3[123];
id = strtok(cmdtext, idx);
amount = strtok(cmdtext, idx);
weapon1 = strtok(cmdtext, idx);
weapon2 = strtok(cmdtext, idx);
weapon3 = strtok(cmdtext, idx);

duelStore(playerid, strval(id), strval(amount), GetWeaponID(weapon1), GetWeaponID(weapon2), GetWeaponID(weapon3));
and this one in an include (note that i DID include this file in the header):

Код:
duelStore(whoSentID, sentToID, Amount, Weapon1, Weapon2, Weapon3){
	duelInfo[whoSentID][sentID] = whoSentID;
	duelInfo[whoSentID][ToID] = sentToID;
	duelInfo[whoSentID][price] = Amount;
	duelInfo[whoSentID][w1] = Weapon1;
	duelInfo[whoSentID][w2] = Weapon2;
	duelInfo[whoSentID][w3] = Weapon3;
}
Even if I remove everything from that function 'duelStore' and recompile, I still get the error. Also, this code is under the 'OnPlayerCommandText' function. Since it's argument 1, the problem is in 'playerid' but I don't see how one integer can be a mismatch to another?


Re: What's wrong with this code? - iJumbo - 27.10.2012

what line give the error?


Re: What's wrong with this code? - Brandlax - 27.10.2012

Nevermind, found my mistake. "GetWeaponID(weapon1)....." the getweaponid function was made to accept int only and i gave string variables.


Re: What's wrong with this code? - iJumbo - 27.10.2012

so GetWeaponID(strval(weaponN))