Abfrage machen ob spieler spawned ist und dann eben if(GetPlayerMoney(playerid) > CurrentMoney bla
wenn geld größer als currentmoney ist dann whatever
Abfrage machen ob spieler spawned ist und dann eben if(GetPlayerMoney(playerid) > CurrentMoney bla
wenn geld größer als currentmoney ist dann whatever
2 Timers
wenn timer 1 zuende ist erstell die objecte
wenn timer 2 zuende ist lösch die objecte wieder
Alles anzeigenMeinst du vielleicht wie man es anwendet?
STRCMP:
if (strcmp("/meinname", cmdtext, true, 10) == 0)
{
new Str[64];
format(Str, sizeof(Str), "", MeinName(playerid));
SendClientMessage(playerid, 0xFFFFFFF, Str);
return 1;
}
stock MeinName(playerid)
{
new myname[MAX_PLAYER_NAME];
GetPlayerName(playerid, myname, sizeof(myname));
return myname;
}
ZCMD:
CMD:meinname( playerid, params[])
{
new Str[64];
format(Str, sizeof(Str), "", MeinName(playerid));
SendClientMessage(playerid, 0xFFFFFFF, Str);
return 1;
}
stock MeinName(playerid)
{
new myname[MAX_PLAYER_NAME];
GetPlayerName(playerid, myname, sizeof(myname));
return myname;
}
er meinte nur wie die stock funktion geht
geht noch kürzer
stock Spielername(playerid) { new NoName[MAX_PLAYER_NAME]; GetPlayerName(playerid,NoName,sizeof NoName); return NoName; }
@dead jo aber hab showplayerdialog rausgenommen und ausserhalb der schleife geschrieben no errors/warn und unknown command
CMD:admins(playerid,params[])
#pragma unused params
{
new Name[MAX_PLAYER_NAME],l1[1000], l2[1000], l3[1000], l4[1000], l5[1000],to[1000];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(Acc[i][Adminlevel] == 5)
{
GetPlayerName(i,Name,sizeof Name);
format(l5, sizeof l5,"Serverleitung %s (ID: %d)",Name,i);
}
else if(Acc[i][Adminlevel] == 4)
{
GetPlayerName(i,Name,sizeof Name);
format(l4, sizeof l4,"Superadmin %s (ID: %d)",Name,i);
}
else if(Acc[i][Adminlevel] == 3)
{
GetPlayerName(i,Name,sizeof Name);
format(l3, sizeof l3,"Admin %s (ID: %d)",Name,i);
}
else if(Acc[i][Adminlevel] == 2)
{
GetPlayerName(i,Name,sizeof Name);
format(l2, sizeof l2,"Super Moderator %s (ID: %d)",Name,i);
}
else if(Acc[i][Adminlevel] == 1)
{
GetPlayerName(i,Name,sizeof Name);
format(l1, sizeof l1,"Moderator %s (ID: %d)",Name,i);
}
}
format(to,sizeof to,"Serverleitung\n\n%s\n\nSuper Administratoren\n\n%s\n\nAdministratoren\n\n%s\n\nSuper Moderatoren\n\n%s\n\nModeratoren\n\n%s\n\n",l5,l4,l3,l2,l1);
ShowPlayerDialog(playerid,DIALOG_INFO,DIALOG_STYLE_MSGBOX,"Online Admins",to,"Schliessen","");
return 1;
}
CMD:admins(playerid,params[]) #pragma unused params { new Name[MAX_PLAYER_NAME],l1[1000], l2[1000], l3[1000], l4[1000], l5[1000],to[1000]; for(new i = 0; i < MAX_PLAYERS; i++) { new Content[500],Content1[500],Content2[500],Content3[500],Content4[500]; if(Acc[i][Adminlevel] == 5) { GetPlayerName(i,Name,sizeof Name); format(l5, sizeof l5,"Serverleitung %s (ID: %d)",Name,i); strcat(Content,l5); } else if(Acc[i][Adminlevel] == 4) { GetPlayerName(i,Name,sizeof Name); format(l4, sizeof l4,"Superadmin %s (ID: %d)",Name,i); strcat(Content1,l4); } else if(Acc[i][Adminlevel] == 3) { GetPlayerName(i,Name,sizeof Name); format(l3, sizeof l3,"Admin %s (ID: %d)",Name,i); strcat(Content2,l3); } else if(Acc[i][Adminlevel] == 2) { GetPlayerName(i,Name,sizeof Name); format(l2, sizeof l2,"Super Moderator %s (ID: %d)",Name,i); strcat(Content3,l2); } else if(Acc[i][Adminlevel] == 1) { GetPlayerName(i,Name,sizeof Name); format(l1, sizeof l1,"Moderator %s (ID: %d)",Name,i); strcat(Content4,l1); } format(to,sizeof to,"Serverleitung\n\n%s\n\nSuper Administratoren\n\n%s\n\nAdministratoren\n\n%s\n\nSuper Moderatoren\n\n%s\n\nModeratoren\n\n%s\n\n",Content,Content1,Content2,Content3,Content4); ShowPlayerDialog(playerid,DIALOG_INFO,DIALOG_STYLE_MSGBOX,"Online Admins",to,"Schliessen",""); } return 1; }
Alles anzeigenWeis nicht obs so Funkt:
CMD:admins(playerid,params[])
#pragma unused params
{
new Name[MAX_PLAYER_NAME],l1[1000], l2[1000], l3[1000], l4[1000], l5[1000],to[1000];
for(new i = 0; i < MAX_PLAYERS; i++)
{
new Content[500],Content1[500],Content2[500],Content3[500],Content4[500];
if(Acc[i][Adminlevel] == 5)
{
GetPlayerName(i,Name,sizeof Name);
format(l5, sizeof l5,"Serverleitung %s (ID: %d)",Name,i);
strcat(Content,l5);
}
else if(Acc[i][Adminlevel] == 4)
{
GetPlayerName(i,Name,sizeof Name);
format(l4, sizeof l4,"Superadmin %s (ID: %d)",Name,i);
strcat(Content1,l4);
}
else if(Acc[i][Adminlevel] == 3)
{
GetPlayerName(i,Name,sizeof Name);
format(l3, sizeof l3,"Admin %s (ID: %d)",Name,i);
strcat(Content2,l3);
}
else if(Acc[i][Adminlevel] == 2)
{
GetPlayerName(i,Name,sizeof Name);
format(l2, sizeof l2,"Super Moderator %s (ID: %d)",Name,i);
strcat(Content3,l2);
}
else if(Acc[i][Adminlevel] == 1)
{
GetPlayerName(i,Name,sizeof Name);
format(l1, sizeof l1,"Moderator %s (ID: %d)",Name,i);
strcat(Content4,l1);
}
format(to,sizeof to,"Serverleitung\n\n%s\n\nSuper Administratoren\n\n%s\n\nAdministratoren\n\n%s\n\nSuper Moderatoren\n\n%s\n\nModeratoren\n\n%s\n\n",Content,Content1,Content2,Content3,Content4);
ShowPlayerDialog(playerid,DIALOG_INFO,DIALOG_STYLE_MSGBOX,"Online Admins",to,"Schliessen","");
}
return 1;
}
Oder versuch das was ich als 1. Gepostet habe.
MfG.
Me
unknown command -.-
habs versucht mit return 1 kommt ber dennoch unknown ich use zcmd und ja der cmd is in keinem callback
kann mir das vil einer mit strcat machen danke!
Kann mir das einer vil so changen wie ich es oben hab ? adminlevel ist mit Acc[playerid][Adminlevel] definiert max adinlv ist 5 und kleinste 1
MFG
Hallo Community kann mir einer sagen was ich falsch gemacht habe oder wie der code kleiner und weniger buggt ?
ich geb /admins ein und server sagt UNKNOWN Command
Hoffe mir kann einer helfen
Danke im vorraus
CODE:
CMD:admins(playerid,params[])
#pragma unused params
{
new Name[MAX_PLAYER_NAME],l1[1000], l2[1000], l3[1000], l4[1000], l5[1000], to[1000];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(Acc[i][Adminlevel] == 5)
{
GetPlayerName(i,Name,sizeof Name);
format(l5, sizeof l5,"%s\n%s (ID: %d)",l5,Name,i);
}
else if(Acc[i][Adminlevel] == 4)
{
GetPlayerName(i,Name,sizeof Name);
format(l4, sizeof l4,"%s\n%s (ID: %d)",l4,Name,i);
}
else if(Acc[i][Adminlevel] == 3)
{
GetPlayerName(i,Name,sizeof Name);
format(l3, sizeof l3,"%s\n%s (ID: %d)",l3,Name,i);
}
else if(Acc[i][Adminlevel] == 2)
{
GetPlayerName(i,Name,sizeof Name);
format(l2, sizeof l2,"%s\n%s (ID: %d)",l2,Name,i);
}
else if(Acc[i][Adminlevel] == 1)
{
GetPlayerName(i,Name,sizeof Name);
format(l1, sizeof l1,"%s\n%s (ID: %d)",l1,Name,i);
}
format(to,sizeof to,""RED"Serverleitung\n\n"ORANGE"%s\n\n"RED"Super Administratoren\n\n"ORANGE"%s\n\n"RED"Administratoren\n\n"ORANGE"%s\n\n"RED"Super Moderatoren\n\n"ORANGE"%s\n\n"RED"Moderatoren\n\n"ORANGE"%s\n\n"RED"Supporter\n\n"ORANGE"%s\n\n",l5,l4,l3,l2,l1);
ShowPlayerDialog(playerid,DIALOG_INFO,DIALOG_STYLE_MSGBOX,""RED"Online Admins",to,"Schliessen","");
}
return ShowPlayerDialog(playerid,DIALOG_INFO,DIALOG_STYLE_MSGBOX,""RED"Online Admins",to,"Schliessen","");
}
Nabend.
Ich hab ein kleines problem mit Strickenkids MySQL plugin.
wenn ich server starte läuft alles ganz normal nur nach einer zeit kommt immer register obwohl ich registriert bin.
wenn ich server neustarte funktioniert es
public OnPlayerConnect(playerid)
{
new name[24];
PlayerLoggin[playerid] = false;
new query[200],escname[24];
GetPlayerName(playerid,name,sizeof name);
GetFromAccount(name,"Passwort",Acc[playerid][Passwort]);
mysql_real_escape_string(name,escname);
format(query,sizeof(query),"SELECT * FROM `Accounts` WHERE `Nickname` = '%s'",escname);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() >= 1)
{
new data[256];
mysql_fetch_field("ID",data);
Acc[playerid][ID] = strval(data);
mysql_fetch_field("Nickname",data);
format(Acc[playerid][Nickname],24,data);
format(Acc[playerid][Nickname],24,data);
mysql_fetch_field("Passwort",data);
format(Acc[playerid][Passwort],30,data);
mysql_fetch_field("Adminlevel",data);
Acc[playerid][Adminlevel] = strval(data);
mysql_fetch_field("Geld",data);
Acc[playerid][Geld] = strval(data);
mysql_fetch_field("Score",data);
Acc[playerid][Score] = strval(data);
mysql_fetch_field("Warns",data);
Acc[playerid][Warns] = strval(data);
mysql_fetch_field("Kills",data);
Acc[playerid][Kills] = strval(data);
mysql_fetch_field("Deaths",data);
Acc[playerid][Deaths] = strval(data);
mysql_fetch_field("Banned",data);
Acc[playerid][Banned] = strval(data);
mysql_fetch_field("Bannedby",data);
format(Acc[playerid][Bannedby],50,data);
mysql_fetch_field("Banreason",data);
format(Acc[playerid][Banreason],50,data);
mysql_fetch_field("Tempbanned",data);
Acc[playerid][Tempbanned] = strval(data);
mysql_fetch_field("Tempban",data);
Acc[playerid][Tempban] = strval(data);
mysql_free_result();
TextDrawShowForPlayer(playerid,Hintergrund);
TextDrawShowForPlayer(playerid,Uhr);
HardwareCheck(playerid);
TempCheck(playerid);
if(Acc[playerid][Adminlevel]>0)
{
TextDrawShowForPlayer(playerid,Admincmd);
new s[50];
GetPlayerName(playerid,name,sizeof name);
format(s,sizeof s,"Admin %s hat den Server betreten",name);
TextDrawSetString(Admincmd,s);
}
if(Acc[playerid][Banned] == 1)
{
new s[256];
GetPlayerName(playerid,name,sizeof name);
SendClientMessage(playerid,COLOR_ORANGE,"This Account is banned");
SendClientMessage(playerid,COLOR_RED,"=====================================");
format(s,sizeof s,"Bannedby Admin %s",Acc[playerid][Bannedby]);
SendClientMessage(playerid,COLOR_LBLUE,s);
format(s,sizeof s,"Banreason from Admin: %s",Acc[playerid][Banreason]);
SendClientMessage(playerid,COLOR_LBLUE,s);
new ip[15];
GetPlayerIp(playerid,ip,sizeof ip);
format(s,sizeof s,"Your Current IP: %s",ip);
SendClientMessage(playerid,COLOR_LBLUE,s);
SendClientMessage(playerid,COLOR_RED,"=====================================");
SendClientMessage(playerid,COLOR_ORANGE,"If you think this Ban is unfair, write a Unban Appeal in our Fourms");
SendClientMessage(playerid,COLOR_ORANGE,"Forum: Forum currently Offline!");
format(s,sizeof s,"Server: %s was kicked by the Server, Reason: Account banned",name);
SendClientMessageToAll(COLOR_ORANGE,s);
printf("%s",s);
Kick(playerid);
}
else
ShowPlayerDialog(playerid,Dialog_Login,DIALOG_STYLE_INPUT,""ORANGE"_.·´¯`·-> "LBLUE"Welcome - Login "ORANGE"<-·´¯`·._",""ORANGE"Your Account was found.\nPlease enter your "RED"correctly Password\n"LBLUE"Info: After 3 login attempts you will be kicked","Login","Cancel");
}
else
{
ShowPlayerDialog(playerid,Dialog_Reg,DIALOG_STYLE_INPUT,""ORANGE"Welcome - Register",""ORANGE"You "RED"havent't an Account "ORANGE"on this Server\n"ORANGE"Please enter an Account Password to register.\n"LBLUE"Info: You need an Account on this Server","Register","Cancel");
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
TextDrawHideForPlayer(playerid,Uhr);
TextDrawHideForPlayer(playerid,Hintergrund);
TextDrawHideForPlayer(playerid,Admincmd);
if(PlayerLoggin[playerid] == true)
{
PlayerLoggin[playerid] = false;
new query[200],name[24],escname[24];
GetPlayerName(playerid,name,sizeof name);
mysql_real_escape_string(name,escname);
format(query,sizeof query,"UPDATE `Accounts` SET `Adminlevel` = '%d' WHERE `Nickname` = '%s'",Acc[playerid][Adminlevel],escname); mysql_query(query);
format(query,sizeof query,"UPDATE `Accounts` SET `Geld` = '%d' WHERE `Nickname` = '%s'",Acc[playerid][Geld],escname); mysql_query(query);
format(query,sizeof query,"UPDATE `Accounts` SET `Score` = '%d' WHERE `Nickname` = '%s'",Acc[playerid][Score],escname); mysql_query(query);
format(query,sizeof query,"UPDATE `Accounts` SET `Warns` = '%d' WHERE `Nickname` = '%s'",Acc[playerid][Warns],escname); mysql_query(query);
format(query,sizeof query,"UPDATE `Accounts` SET `Kills` = '%d' WHERE `Nickname` = '%s'",Acc[playerid][Kills],escname); mysql_query(query);
format(query,sizeof query,"UPDATE `Accounts` SET `Deaths` = '%d' WHERE `Nickname` = '%s'",Acc[playerid][Deaths],escname); mysql_query(query);
format(query,sizeof query,"UPDATE `Accounts` SET `Banned` = '%d' WHERE `Nickname` = '%s'",Acc[playerid][Banned],escname); mysql_query(query);
format(query,sizeof query,"UPDATE `Accounts` SET `Bannedby` = '%s' WHERE `Nickname` = '%s'",Acc[playerid][Bannedby],escname); mysql_query(query);
format(query,sizeof query,"UPDATE `Accounts` SET `Banreason` = '%s' WHERE `Nickname` = '%s'",Acc[playerid][Banreason],escname); mysql_query(query);
format(query,sizeof query,"UPDATE `Accounts` SET `Tempbanned` = '%d' WHERE `Nickname` = '%s'",Acc[playerid][Tempbanned],escname); mysql_query(query);
format(query,sizeof query,"UPDATE `Accounts` SET `Tempban` = '%d' WHERE `Nickname` = '%s'",Acc[playerid][Tempban],escname); mysql_query(query);
mysql_free_result();
}
return 1;
}
ich weiß der code is lang und man könnte ihn kürzen was ich auch machen werde aber ich weiß trotdem das problem nicht.
hoffe es kann einer helfen
PS: Linux Server
EDIT: keiner eine idee ?
EDIT2: dump pls help
DELETED sorry aber pcl laggt grad extrem. aber wenn ich zeit hab werd ich ma eins machen :@
was für ein mysql plugin benutzt du ?
[pwn]stock Sms2(playerid)
{
MAX_NACHRICHTEN[playerid]=0;
new Nama[MAX_PLAYER_NAME];
GetPlayerName(playerid,Nama,sizeof(Nama));
new mysql[60];
format(mysql, sizeof (mysql), "SELECT * FROM sms WHERE Empfänger = '%s' ORDER BY ÌD DESC",Nama);
mysql_query(mysql);
mysql_store_result();
if(mysql_num_rows() > 0)
{
new string[256];
new Data[128];
while(mysql_fetch_row_format(Data[playerid]))
{
MAX_NACHRICHTEN[playerid]++;
new id2 = MAX_NACHRICHTEN[playerid];
mysql_fetch_field("ID",Data[playerid]);
NachrichtenArray[playerid][id2][idm] = strval(Data[playerid]);
mysql_fetch_field("Sender",Data[playerid],);
id2 = MAX_NACHRICHTEN[playerid];
format(NachrichtenArray[playerid][id2][absenderm],24,Data[playerid]);
format(string, sizeof(string), "%s\nVon:%s",string,NachrichtenArray[playerid][MAX_NACHRICHTEN[playerid]][inhaltm]);
}
mysql_free_result();
SendClientMessage(playerid,Rot,string);
ShowPlayerDialog(playerid,DIALOG_SMS,DIALOG_STYLE_LIST,"SMS Postfach",string,"Beenden"," ");
}
else
{
SendClientMessage(playerid,Rot,"Du hast keine Nachrichten.");
}
return 1;
}[/pwn]
versuch das ma wenn du daten fetchst brauchste MAX_PLAYERS net^^
Zeig uns mal dein OnPlayerConnect zeug
wobei er achten muss das es format(playerverriable,24,name); sein muss wobei name in GetPlayerName generiert wird
Wie wird gPlayerName erstellt und wo wird da ein Wert zugewiesen?
fra ich mich auch ich würd 2 namen definieren und eben dann im string einbinden
GetPlayerName
Du brauchst 2 namen mit GetPlayerName
1 für den sendespieler und den anderen für den empfänger
edit es reicht auch wenn du 1 string definierst du brauchst keine 2
Tuts schon weh?
was meinst du ?
ein string ist z.B ein name mit dem du connectest.
du kannst new String[128]; machen.
Die 128 ist die Länge des Strings wobei 128 die maximal länge in samp ist
Strings kannst du z.B so bei OnPlayerConnect oder sonstwo verwenden z.B bei Admin kick cmd etc
Hier mal ein Simples String beim Connect
public OnPlayerConnect(playerid)
{
new String[128],Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof Name);
format(String, sizeof String,"%s hat den Server betreten!",Name);
SendClientMessageToAll(0xFF0000FF,String);
return 1;
}
z.B wenn du mit den Namen "Test" connectest erscheint in Rot: "Test hat den Server betreten!"
forward FlageYAKI(playerid,gebietid);
public FlageYAKI(playerid,gebietid)
{
if(!IsPlayerInRangeOfPoint(playerid,3.0,1393.8271,-2500.6570,13.5547))
{
SendClientMessage(playerid,COLOR_REDA,"Du konntest die Flagge nicht Verteidigen, da duch dich zu weit von der Flagge entfernt hast!");
Einnahme = 0;
return 1;
}
for (new i = 0; i < MAX_PLAYERS; i++)
{
for(new a = 0; a < sizeof(Gangwar); a++)
{
if(SpielerInfo[i][pLeader] == 6 || SpielerInfo[i][pMember] == 6)
{
if(IsPlayerConnected(i))
{
new Yakii[MAX_PLAYER_NAME];
new Yakuzsad[256];
GetPlayerName(playerid,Yakii,sizeof Yakii);
format(Yakuzsad, 256, "%s hat die Flagge erfolgreich Verteidigt!",Yakii);
SendClientMessage(i,COLOR_REDA,Yakuzsad);
SendClientMessage(playerid,COLOR_WHITE,"Du hast eure Flagge erfolgreich Verteidigt!");
Einnahme = 0;
Gangwar[a][PunkteYAKI] += 1;
}
}
if(SpielerInfo[i][pLeader] == 5 || SpielerInfo[i][pMember] == 5)
{
new Verteiyaki[MAX_PLAYER_NAME];
new Yakuikad[256];
GetPlayerName(playerid,Verteiyaki,sizeof Verteiyaki);
format(Yakuikad, 256, "%s hat die Flagge der Yakuza erfolgreich Verteidigt!",Verteiyaki);
SendClientMessage(i,COLOR_REDA,Yakuikad);
}
}
}
return 1;
}
So müsste es funktionieren durch die If(IsPlayerConnected(i)) abfrage