Code
ocmd:createcardealer(playerid,params[])
{
new name[32],price,level,Float:xPos[3];
if(pInfo[playerid][pAdmin] != 5)return 1;
if(sscanf(params,"dds[32]",price,level,name))return SendClientMessage(playerid,COLOR_GREY,"Benutze: /createcardealer [Preis] [Level] [Name]");
for(new i;i<MAX_AUTOHAUS;i++) {
if(AHInfo[i][zCreated])continue;
new str[256];
GetPlayerPos(playerid,xPos[0],xPos[1],xPos[2]);
format(str,sizeof str,"INSERT INTO `Cardealers` (`Owner`, `PosX`, `PosY`, `PosZ`, `Name`, `Price`, `Level`, `LPosX`, `LPosY`, `LPosZ`) VALUES ('Niemand', '%f', '%f', '%f', '%s', '%d', '%d', '%f', '%f', '%f')",xPos[0],xPos[1],xPos[2],name,price,level,xPos[0],xPos[1],xPos[2]);
mysql_query(str);
return LoadCarDealer(i);
}
return 1;
}
Alles anzeigen
Code
stock LoadCarDealer(id)
{
new q[256];
format(q,256,"SELECT * FROM `Cardealers` WHERE `ID` = '%d'",id+1);
mysql_query(q);
mysql_store_result();
if(mysql_num_rows() == 1) {
new str[512];
while(mysql_fetch_row(str)) {
for(new i;i<MAX_AUTOHAUS;i++) {
if(AHInfo[i][zCreated])continue;
new string[256];
sscanf(str, "e<p<|>ds[32]fffds[24]ddddfff>",AHInfo[i]);
if((!strcmp(AHInfo[i][zOwner],"Niemand",true))) {
AHInfo[i][zPickup]=CreatePickup(1273,1,AHInfo[i][zPosX],AHInfo[i][zPosY],AHInfo[i][zPosZ],0);
format(string,128,"** %s **\nDieses Autohaus ist zu verkaufen!\nPreis: %s€\nLevel: %d\nAutohaus kaufen: /buybiz",AHInfo[i][zName],inspoints(AHInfo[i][zPrice]),AHInfo[i][zLevel]);
AHInfo[i][zLabel]=Create3DTextLabel(string,COLOR_AHLABEL,AHInfo[i][zPosX],AHInfo[i][zPosY],AHInfo[i][zPosZ],10,0,1);
AHInfo[i][zCreated] = true;
} else {
AHInfo[i][zPickup]=CreatePickup(1272,1,AHInfo[i][zPosX],AHInfo[i][zPosY],AHInfo[i][zPosZ],0);
format(string,128,"** %s **\nBesitzer: %s",AHInfo[i][zName],AHInfo[i][zOwner]);
AHInfo[i][zLabel]=Create3DTextLabel(string,COLOR_AHLABEL,AHInfo[i][zPosX],AHInfo[i][zPosY],AHInfo[i][zPosZ],10,0,1);
AHInfo[i][zCreated] = true;
}
return 1;
}
}
mysql_free_result();
}
return 1;
}
Alles anzeigen