Hallo Brotfische,
Ich habe folgendes Problem, wenn ich als Admin /drop eingebe können alle User item´s aufheben wie z.B: 12 Doller, problem ist nur die User können auch Hausmaker von ihren Häusern einsammel und bekommen dafür geld
Codes:
enum dropenum{
drop_type,
Float:drop_x,
Float:drop_y,
Float:drop_z,
drop_anzahl,
drop_virtualworld,
id_x,
Text3D:textlabel,
db_id
}
new dropInfo[5000][dropenum];
forward OnDrop(id);
forward OnDropsLoad();
//OnGameModeInit
loadDrops();
loadDrops()
{
new query[128];
format(query,sizeof(query),"SELECT * FROM drops WHERE id>='%i'",0);
mysql_function_query(dbhandle,query,true,"OnDropsLoad","");
return 1;
}
public OnDropsLoad()
{
new num_fields,num_rows;
cache_get_data(num_rows,num_fields,dbhandle);
if(!num_rows)return 1;
for(new i=0; i<num_rows; i++)
{
new id=GetFreeDropID(),string[128];
dropInfo[id][drop_type]=cache_get_field_content_int(i,"pickup",dbhandle);
dropInfo[id][drop_x]=cache_get_field_content_float(i,"x",dbhandle);
dropInfo[id][drop_y]=cache_get_field_content_float(i,"y",dbhandle);
dropInfo[id][drop_z]=cache_get_field_content_float(i,"z",dbhandle);
dropInfo[id][drop_anzahl]=cache_get_field_content_int(i,"anzahl",dbhandle);
dropInfo[id][drop_virtualworld]=cache_get_field_content_int(i,"VW",dbhandle);
dropInfo[id][db_id]=cache_get_field_content_int(i,"id",dbhandle);
format(string,sizeof(string),"Anzahl: %i",dropInfo[id][drop_anzahl]);
dropInfo[id][id_x]=CreatePickup(dropInfo[id][drop_type],1,dropInfo[id][drop_x],dropInfo[id][drop_y],dropInfo[id][drop_z],dropInfo[id][drop_virtualworld]);
dropInfo[id][textlabel]=Create3DTextLabel(string,C_Weiß,dropInfo[id][drop_x],dropInfo[id][drop_y],dropInfo[id][drop_z],10.0,dropInfo[id][drop_virtualworld],0);
}
return 1;
}
ocmd:drop(playerid,params[])
{
if(!isAdmin(playerid,1))return SendClientMessage(playerid,C_Error,"Du bist kein Admin."); //Admin abfrage, muss aber angepasst werden, weil ich nicht weiss, welches admin system du hast
ShowPlayerDialog(playerid,DIALOG_Trop,2,"Trop-Menü","Dollar\nM4","Wähle","Abbrechen");
return 1;
}
//OnPlayerPickUpPickup
for(new i; i<sizeof(dropInfo);i++)
{
if(dropInfo[i][id_x]>0)
{
if(dropInfo[i][drop_type]==item_dollar)
{
new query[128];
giveplayermoney(playerid,dropInfo[i][drop_anzahl]);
format(query,sizeof(query),"DELETE FROM drops WHERE id='%i'", dropInfo[i][db_id]);
DestroyPickup(pickupid);
Delete3DTextLabel(dropInfo[i][textlabel]);
}
return 1;
}
}
GetFreeDropID()
{
for(new i; i<sizeof(dropInfo); i++)
{
if(!(i>0)) return i;
}
return 1;
}
stock Drop(type,Float:x,Float:y,Float:z,anzahl,virtualworld)
{
new id = GetFreeDropID();
new query[128],string[32];
format(string,sizeof(string),"Anzahl: %i",anzahl);
dropInfo[id][id_x]=CreatePickup(type,1,x+1,y,z,virtualworld);
dropInfo[id][textlabel]=Create3DTextLabel(string,C_Weiß,x+1,y,z,10.0,virtualworld,0);
format(query,sizeof(query),"INSERT INTO drops (pickup,x,y,z,anzahl,VW) VALUES ('%i','%f','%f','%f','%i','%i')",type,x,y,z,anzahl,virtualworld);
mysql_function_query(dbhandle,query,false,"","");
dropInfo[id][drop_type]=type;
dropInfo[id][drop_x]=x;
dropInfo[id][drop_y]=y;
dropInfo[id][drop_z]=z;
dropInfo[id][drop_anzahl]=anzahl;
dropInfo[id][drop_virtualworld]=virtualworld;
mysql_function_query(dbhandle, query, true, "OnDrop", "i", id);
return 1;
}
public OnDrop(id)
{
dropInfo[id][db_id]=cache_insert_id();
return 1;
}
//OnDialogResponse
if(dialogid == DIALOG_DOLLAR)
{
if(response==0)
{
SendClientMessage(playerid,COLOR_BLUE,"Du hast den Vorgang abgebrochen.");
return 1;
}
if(response==1)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,DIALOG_DOLLAR,DIALOG_STYLE_INPUT,"Dollar","Du musst etwas eingeben.\nWie viel Dollar möchtest du droppen?","Bestätigen","Abbrechen");
return 1;
}
else
{
new Float:x,Float:y,Float:z,anzahl;
anzahl = strval(inputtext);
GetPlayerPos(playerid,x,y,z);
Drop(item_dollar,x,y,z,anzahl,GetPlayerVirtualWorld(playerid));
return 1;
}
}
}
if(dialogid == DIALOG_Trop)
{
if(response == 0)
{
}
if(response == 1)
{
switch (listitem)
{
case 0:
{
ShowPlayerDialog(playerid,DIALOG_DOLLAR,DIALOG_STYLE_INPUT,"Dollar","Wie viel Dollar möchtest du droppen?","Bestätigen","Abbrechen");
}
case 1:
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
CreatePickup(356,1,x,y,z,0);
}
}
}
}
Ich hoffe es kann mir jemand helfen
MFG German_ScripterHD
.