if (strcmp("/weapon", cmdtext, true, 10) == 0) // Shows Admin Command List
{
if(donator[playerid] == 1)
{
ShowPlayerDialog(playerid,DONATOR_DIALOG,2,"Choose a Weapon","Uzi\nAk47\nSawn-Off Shotgun\nTec9\nSMG\nCombat Shotgun","Buy","Cancel");
}
else
SendClientMessage(playerid,0xFF0000AA,"This Command is for Donators only, Donate to unlock it!");
return 1;
}
new Dweapons;
Dweapons ++;
if(Dweapons > 3) SendClientMessage(0xFF0000AA, "You can only get items 3 times a spawn");
Dweapons = 0
new Dweapons;
Dweapons = 0;
Dweapons = 0;
if(dialogid==DONATOR_DIALOG)
{
if(response)
{
if(listitem==0)
{
GivePlayerWeapon(playerid, 28, 150);
Dweapons ++;
return 1;
}
if(listitem==1)
{
GivePlayerWeapon(playerid, 30, 150);
Dweapons ++;
return 1;
}
if(listitem==2)
{
GivePlayerWeapon(playerid, 26, 150);
Dweapons ++;
return 1;
}
if(listitem==3)
{
GivePlayerWeapon(playerid, 32, 150);
Dweapons ++;
return 1;
}
if(listitem==4)
{
GivePlayerWeapon(playerid, 29, 150);
Dweapons ++;
return 1;
}
if(listitem==5)
{
GivePlayerWeapon(playerid, 27, 150);
Dweapons ++;
return 1;
}
if(listitem==6)
{
GivePlayerWeapon(playerid,35,15);
Dweapons ++;
return 1;
}
else
if(Dweapons > 3) SendClientMessage(0xFF0000AA, "You can only get items 3 times a spawn");
return 1;
}
}
(13259) : error 035: argument type mismatch (argument 2)
if(Dweapons > 3) SendClientMessage(0xFF0000AA, "You can only get items 3 times a spawn");
if(Dweapons > 3) SendClientMessage(playerid, 0xFF0000AA, "You can only get items 3 times a spawn");
new Dweapons[MAX_PLAYERS];
Dweapons[playerid] = 0;
if(dialogid==DONATOR_DIALOG)
{
if(response)
{
if(Dweapons >= 3) SendClientMessage(0xFF0000AA, "You can only get items 3 times a spawn");
if(listitem==0)
{
GivePlayerWeapon(playerid, 28, 150);
Dweapons[playerid] ++;
return 1;
}
if(listitem==1)
{
GivePlayerWeapon(playerid, 30, 150);
Dweapons[playerid] ++;
return 1;
}
if(listitem==2)
{
GivePlayerWeapon(playerid, 26, 150);
Dweapons[playerid] ++;
return 1;
}
if(listitem==3)
{
GivePlayerWeapon(playerid, 32, 150);
Dweapons[playerid] ++;
return 1;
}
if(listitem==4)
{
GivePlayerWeapon(playerid, 29, 150);
Dweapons[playerid] ++;
return 1;
}
if(listitem==5)
{
GivePlayerWeapon(playerid, 27, 150);
Dweapons[playerid] ++;
return 1;
}
if(listitem==6)
{
GivePlayerWeapon(playerid,35,15);
Dweapons[playerid] ++;
return 1;
}
}
Originally Posted by CAR
TOP
pawn Код:
pawn Код:
pawn Код:
|
error 033: array must be indexed (variable "Dweapons") error 035: argument type mismatch (argument 2)
if(Dweapons >= 3) SendClientMessage(0xFF0000AA, "You can only get items 3 times a spawn");
Originally Posted by [ĦŁ₣
ЉǾǖŦĦЗŁΛẄ ]
You still haven't added what I said to add, scroll up and look at my last post. The 'Array must be indexed' means you haven't told it what part of the array 'Dweapons' you are checking to be above 3 This is how arrays work: they are like variables bit split into loads of parts so: new Array[20]; this array has 20 parts and you can assign each part different values etc: Array[3] = 4 this makes the 2nd part of it worth 4 [it is the 2nd part because they always start on zero '0' so count form zero to 2 and it is 3: 0,1,2] You are creating the array with MAX_PLAYERS as the size so this makes the array into 500 parts and when you use 'playerid' as the 'index' [the 'part' number] it assigns the value to that players number so if it's playerid 2 then Array[playerid] will assign the 3rd part the value [remember they start on 0] Understand arrays now? Your problem is that you haven't told the compiler what 'part' of the array you want to check that it's above 3: if(Dweapons >= 3) You need to tell it that you want to see if the playerid who responded on the dialog has selected weapons 3 times To fix this just add a playerid array definition after the array: if(Dweapons[playerid] >= 3) Now the code should work fine. Hope that helps |
Originally Posted by [ĦŁ₣
ЉǾǖŦĦЗŁΛẄ ]
That's no problem, I like to help wherever I can :P I messed up the text a bit by not ending the [ sup ] tag on '3rd' :P all fixed now Glad it helped |