Hallo leute,
Ich habe mal ne Frage:
Wenn ich ne "if" Abfrage in nem Public starte, will ich einen Text "RETURNEN".
Mein Code sieht so aus:
if(frak == 0){ return "-"; }
Allerdings will mein Compiler dann nicht so ganz... Jemand ne lösung?
MfG Firer
Hallo leute,
Ich habe mal ne Frage:
Wenn ich ne "if" Abfrage in nem Public starte, will ich einen Text "RETURNEN".
Mein Code sieht so aus:
if(frak == 0){ return "-"; }
Allerdings will mein Compiler dann nicht so ganz... Jemand ne lösung?
MfG Firer
Inwiefern returnen? Als Nachricht an wen?
//Edit
if(frak == 0) return SendClientMessage(playerid,Farbe,"Nachricht");
Meinste so?
//Edit2
Mkay mom
Nein, es ist ein public um die Fraktion des Spielers rauszufinden.
Sprich um es z.B. in einem String zu verwenden.
//EDIT: Zu deinem Edit Ink:
Nee, das benutze ich so ja berreits in meinen DCMD-Commands
Zeig mal dat public wenns nicht zu groß ist
public GetPlayerRank(playerid)
{
new frak = GetPVarInt(playerid,"team");
new rank = GetPVarInt(playerid,"rank");
if(frak == 0){ return "-"; }
if(frak == 1)
{
if(rank == 1){ return "Auszubildener"; }
}
return 1;
}
Ist halt erstmal um zu schauen, ob ich es irgendwie hinkriege^^
//EDIT:
Durch Maddins hilfe hab ichs mal mit nem String versucht:
public GetPlayerRank(playerid)
{
new frak = GetPVarInt(playerid,"team");
new rank = GetPVarInt(playerid,"rank");
new string[50];
if(frak == 0){ format(string,sizeof(string),"-"); return string; }
if(frak == 1)
{
if(rank == 1){format(string,sizeof(string),"Auszubildener"); return string; }
}
return 1;
}
Allerdings bekomme ich Errors:
C:\Dokumente und Einstellungen\Alex\Desktop\SOUL-GTA\gamemodes\sf.pwn(1612) : error 090: public functions may not return arrays (symbol "GetPlayerRank")
C:\Dokumente und Einstellungen\Alex\Desktop\SOUL-GTA\gamemodes\sf.pwn(1615) : error 090: public functions may not return arrays (symbol "GetPlayerRank")
C:\Dokumente und Einstellungen\Alex\Desktop\SOUL-GTA\gamemodes\sf.pwn(1617) : error 079: inconsistent return types (array & non-array)
//EDIT2: Hahahahaha - Ich brauch nen Stock und kein Public - Das ist zu Failed^^
/CLOSE/
Gute Idee, schau mal obs so funzt:
stock GetPlayerRank(playerid)
{
new frak = GetPVarInt(playerid,"team");
new rank = GetPVarInt(playerid,"rank");
new string[50];
if(frak == 0){ string = "-"; }
if(frak == 1)
{
if(rank == 1) { string = "Auszubildener"); }
}
return string;
}
//Edit mkay wenne es hast...