24.05.2014, 08:51
Quote:
The very first column in all tables that you create i recommand to be ID with (not necessarly if you do it from script) auto_increment and index unique. This way you know exactly what column you're editing.
In the code you posted i can't see where you're using sscanf, but be sure that if you are using it, you use it correctly. The number of given parameters is equal and as the same type as the variables that you are saving the values in. You can read this for more help about the warning:https://sampforum.blast.hk/showthread.php?tid=361016 |
PHP код:
CMD:bedit(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 1338)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Ban khong duoc phep su dung lenh nay.");
return 1;
}
new string[128], choice[32], bizid, amount, businesstype[128];
if(sscanf(params, "s[32]dD", choice, bizid, amount))
{
SendClientMessageEx(playerid, COLOR_GREY, "SUDUNG: /bedit [name] [bizid] [(Optional)amount]");
SendClientMessageEx(playerid, COLOR_GREY, "Available names: Exterior, Interior, Type, Price, PickupModel.");
return 1;
}
if(bizid >= MAX_BUSINESSES)
{
SendClientMessageEx( playerid, COLOR_WHITE, "Khong Hop le BIZ!");
return 1;
}
if(strcmp(choice, "interior", true) == 0)
{
new virworld = random(99999)+100000;
GetPlayerPos(playerid, BizzInfo[bizid][bExitX], BizzInfo[bizid][bExitY], BizzInfo[bizid][bExitZ]);
BizzInfo[bizid][bVirWorld] = PlayerInfo[playerid][pVW];
BizzInfo[bizid][bInterior] = GetPlayerInterior(playerid);
BizzInfo[bizid][bVirWorld] = virworld;
SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the interior!" );
SaveBusiness(bizid);
format(string, sizeof(string), "%s has edited BizID %d's Interior.", GetPlayerNameEx(playerid), bizid);
Log("logs/bedit.log", string);
return 1;
}
if(strcmp(choice, "deliver", true) == 0)
{
GetPlayerPos(playerid, BizzInfo[bizid][bDeliverX], BizzInfo[bizid][bDeliverY], BizzInfo[bizid][bDeliverZ]);
SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the deliver!" );
DestroyDynamic3DTextLabel(business3[bizid]);
format(string, sizeof(string), "{808080}Dia Diem Van Chuyen Hang\n\t%s\n\t%s\nID: %d",businesstype, BizzInfo[bizid][bMessage], bizid);
business3[bizid] = CreateDynamic3DTextLabel(string, 0xFFFFFF88, BizzInfo[bizid][bDeliverX]+ 1, BizzInfo[bizid][bDeliverY]+1, BizzInfo[bizid][bDeliverZ]+0.75,10.0,INVALID_PLAYER_ID,INVALID_VEHICLE_ID,0,0,-1,-1, 100.0);
SaveBusiness(bizid);
format(string, sizeof(string), "%s has edited BizID %d's deliver point.", GetPlayerNameEx(playerid), bizid);
Log("logs/bedit.log", string);
return 1;
}
else if(strcmp(choice, "exterior", true) == 0)
{
GetPlayerPos(playerid, BizzInfo[bizid][bEntranceX], BizzInfo[bizid][bEntranceY], BizzInfo[bizid][bEntranceZ]);
SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the exterior!" );
format(string, sizeof(string), "%s has edited BizID %d's Exterior.", GetPlayerNameEx(playerid), bizid);
Log("logs/bedit.log", string);
SaveBusiness(bizid);
DynamicBusinesses(bizid);
}
else if(strcmp(choice, "price", true) == 0)
{
BizzInfo[bizid][bBuyPrice] = amount;
format(string, sizeof(string), "You have set the BizID price to $%d.", amount );
SendClientMessageEx(playerid, COLOR_WHITE, string);
SaveBusiness(bizid);
DynamicBusinesses(bizid);
format(string, sizeof(string), "%s has edited BizID %d's Price to $%d.", GetPlayerNameEx(playerid), amount);
Log("logs/bedit.log", string);
}
else if(strcmp(choice, "type", true) == 0)
{
if(amount < 1 || amount > 12) { SendClientMessage(playerid, COLOR_GREY, " Business Type khong the duoi 1 hoac tren 10!"); return 1; }
BizzInfo[bizid][bType] = amount;
SaveBusiness(bizid);
DynamicBusinesses(bizid);
format( string, sizeof( string ), "You have set the Business (ID: %d) type to a %s.", bizid, businesstype);
SendClientMessage( playerid, COLOR_WHITE, string);
}
else if(strcmp(choice, "pickupmodel", true) == 0)
{
BizzInfo[bizid][bPickkupModel] = amount;
format(string, sizeof(string), "Ban da doi pickupmodel sang %d.", amount);
SendClientMessageEx(playerid, COLOR_WHITE, string);
DestroyPickupEx(BizzInfo[bizid][bPickupID]);
PickUpBiz(bizid);
SaveBusiness(bizid);
DynamicBusinesses(bizid);
format(string, sizeof(string), "%s da doi pickupmodel biz id %d.", GetPlayerNameEx(playerid), bizid);
Log("logs/bedit.log", string);
return 1;
}
SaveBusiness(bizid);
return 1;
}