4 errors(compile) in_array doesn't work -
MCZOFT - 24.10.2014
hello ,
i wanna make something is that if player goes binco and types for example the command /buyclothes (id )
it works but i want to disactive some skins id from there so that player if he types a SKIN id already on the array for example
70 , he will tell hem restricted skin .. so i've created an array but this last wont work( wont get compiled )
have alook on that code and tell me why isnt working
PHP код:
C:\Users\ZOFTer\Desktop\0.3Z server\gamemodes\UG-RP.pwn(24975) : error 048: array dimensions do not match
C:\Users\ZOFTer\Desktop\0.3Z server\gamemodes\UG-RP.pwn(24975) : error 001: expected token: ",", but found "sizeof"
C:\Users\ZOFTer\Desktop\0.3Z server\gamemodes\UG-RP.pwn(24975) : warning 215: expression has no effect
C:\Users\ZOFTer\Desktop\0.3Z server\gamemodes\UG-RP.pwn(24975) : error 001: expected token: ";", but found ")"
C:\Users\ZOFTer\Desktop\0.3Z server\gamemodes\UG-RP.pwn(24975) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
PHP код:
if you guys want the command i'll pass it
PHP код:
if(dialogid == SKINMENU)
{
if(response)
{
new price = BizzInfo[PlayerInfo[playerid][InBusiness]][bProductPrice1];
new Coolarray[][] = {
"70",
"71",
"274"
};
if(!(in_array(Coolarray, strval(inputtext), size = sizeof Coolarray))) { //****24975****
if(strval(inputtext) < 0 || strval(inputtext) > 299) { SendClientMessage(playerid, COLOR_GREY, " Skin can't be below 0 or above 299!"); return 1; }
if(IsInvalidSkin(strval(inputtext))) { SendClientMessage(playerid, COLOR_GREY, " Invalid skin!"); return 1; }
if(PlayerInfo[playerid][pCash] >= price)
{
SetPlayerSkin(playerid, strval(inputtext));
PlayerInfo[playerid][pModel] = strval(inputtext);
format(string, sizeof(string), "You're new clothes have been purchased for $%d.", price);
SendClientMessage(playerid, COLOR_YELLOW, string);
PlayerInfo[playerid][pCash] -= price;
GivePlayerMoney(playerid, -price);
BizzInfo[PlayerInfo[playerid][InBusiness]][bTill] += price;
SaveBusiness(PlayerInfo[playerid][InBusiness]);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You don't have enough money!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Restricted skin!");
return 1;
}
}
}
Re: 4 errors(compile) in_array doesn't work -
Quickie - 25.10.2014
pawn Код:
if(!(in_array(Coolarray, strval(inputtext), /*size = */sizeof( Coolarray))))
EDIT: im not sure about this.:P just unquote if it still got an error
Re : 4 errors(compile) in_array doesn't work -
MCZOFT - 25.10.2014
PHP код:
C:\Users\ZOFTer\Desktop\0.3Z server\gamemodes\UG-RP.pwn(24986) : error 017: undefined symbol "in_array"
C:\Users\ZOFTer\Desktop\0.3Z server\gamemodes\UG-RP.pwn(24986) : warning 202: number of arguments does not match definition
PHP код:
if(dialogid == SKINMENU)
{
if(response)
{
new price = BizzInfo[PlayerInfo[playerid][InBusiness]][bProductPrice1];
new Coolarray[][] = {
"70",
"71",
"274"
};
if(!(in_array(Coolarray, strval(inputtext), /*size = */sizeof( Coolarray)))) { // 24986 line
if(strval(inputtext) < 0 || strval(inputtext) > 299) { SendClientMessage(playerid, COLOR_GREY, " Skin can't be below 0 or above 299!"); return 1; }
if(IsInvalidSkin(strval(inputtext))) { SendClientMessage(playerid, COLOR_GREY, " Invalid skin!"); return 1; }
if(PlayerInfo[playerid][pCash] >= price)
{
SetPlayerSkin(playerid, strval(inputtext));
PlayerInfo[playerid][pModel] = strval(inputtext);
format(string, sizeof(string), "You're new clothes have been purchased for $%d.", price);
SendClientMessage(playerid, COLOR_YELLOW, string);
PlayerInfo[playerid][pCash] -= price;
GivePlayerMoney(playerid, -price);
BizzInfo[PlayerInfo[playerid][InBusiness]][bTill] += price;
SaveBusiness(PlayerInfo[playerid][InBusiness]);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You don't have enough money!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Restricted skin!");
return 1;
}
}
}
Re: 4 errors(compile) in_array doesn't work -
Sawalha - 25.10.2014
in_array definition?
Re : 4 errors(compile) in_array doesn't work -
MCZOFT - 25.10.2014
Sawalha in_array just i found the idea on c++ lang . so in samp i dont know alot about it , if you know how to define it , becuause it's not like in c++
Re: 4 errors(compile) in_array doesn't work -
Sawalha - 25.10.2014
Oh, Then try
pawn Код:
if(!(in_array(Coolarray, strval(inputtext))))
without "sizeof"
Re : 4 errors(compile) in_array doesn't work -
MCZOFT - 25.10.2014
PHP код:
C:\Users\ZOFTer\Desktop\0.3Z server\gamemodes\UG-RP.pwn(24976) : error 017: undefined symbol "in_array"
PHP код:
if(dialogid == SKINMENU)
{
if(response)
{
new price = BizzInfo[PlayerInfo[playerid][InBusiness]][bProductPrice1];
new Coolarray[][] = {
"70",
"71",
"274"
};
if(!(in_array(Coolarray, strval(inputtext)))) { // 24976 line
if(strval(inputtext) < 0 || strval(inputtext) > 299) { SendClientMessage(playerid, COLOR_GREY, " Skin can't be below 0 or above 299!"); return 1; }
if(IsInvalidSkin(strval(inputtext))) { SendClientMessage(playerid, COLOR_GREY, " Invalid skin!"); return 1; }
if(PlayerInfo[playerid][pCash] >= price)
{
SetPlayerSkin(playerid, strval(inputtext));
PlayerInfo[playerid][pModel] = strval(inputtext);
format(string, sizeof(string), "You're new clothes have been purchased for $%d.", price);
SendClientMessage(playerid, COLOR_YELLOW, string);
PlayerInfo[playerid][pCash] -= price;
GivePlayerMoney(playerid, -price);
BizzInfo[PlayerInfo[playerid][InBusiness]][bTill] += price;
SaveBusiness(PlayerInfo[playerid][InBusiness]);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You don't have enough money!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Restricted skin!");
return 1;
}
}
}
Re: 4 errors(compile) in_array doesn't work -
Sawalha - 25.10.2014
in_array function is not installed in PAWNO version, You may define it:
pawn Код:
stock in_array(array[], value, size = sizeof array)
{
for(new i; i < size; i++)
{
if(array[i] == value) return 1;
}
return 0;
}
// By Misiur
you can now add sizeof.
Re : 4 errors(compile) in_array doesn't work -
MCZOFT - 25.10.2014
let me see if it will work
Re : 4 errors(compile) in_array doesn't work -
MCZOFT - 25.10.2014
PHP код:
C:\Users\ZOFTer\Desktop\0.3Z server\gamemodes\UG-RP.pwn(24976) : error 029: invalid expression, assumed zero
C:\Users\ZOFTer\Desktop\0.3Z server\gamemodes\UG-RP.pwn(24976) : error 001: expected token: ",", but found "sizeof"
C:\Users\ZOFTer\Desktop\0.3Z server\gamemodes\UG-RP.pwn(24976) : warning 215: expression has no effect
C:\Users\ZOFTer\Desktop\0.3Z server\gamemodes\UG-RP.pwn(24976) : error 001: expected token: ";", but found ")"
C:\Users\ZOFTer\Desktop\0.3Z server\gamemodes\UG-RP.pwn(24976) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.
PHP код:
if(dialogid == SKINMENU)
{
if(response)
{
new price = BizzInfo[PlayerInfo[playerid][InBusiness]][bProductPrice1];
new Coolarray[][] = {
"70",
"71",
"274"
};
if(!(in_array(Coolarray[], value, size = sizeof Coolarray))) { // 24976
if(strval(inputtext) < 0 || strval(inputtext) > 299) { SendClientMessage(playerid, COLOR_GREY, " Skin can't be below 0 or above 299!"); return 1; }
if(IsInvalidSkin(strval(inputtext))) { SendClientMessage(playerid, COLOR_GREY, " Invalid skin!"); return 1; }
if(PlayerInfo[playerid][pCash] >= price)
{
SetPlayerSkin(playerid, strval(inputtext));
PlayerInfo[playerid][pModel] = strval(inputtext);
format(string, sizeof(string), "You're new clothes have been purchased for $%d.", price);
SendClientMessage(playerid, COLOR_YELLOW, string);
PlayerInfo[playerid][pCash] -= price;
GivePlayerMoney(playerid, -price);
BizzInfo[PlayerInfo[playerid][InBusiness]][bTill] += price;
SaveBusiness(PlayerInfo[playerid][InBusiness]);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You don't have enough money!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Restricted skin!");
return 1;
}
}
}