Du hast bei den Befehlen unter OnPlayerCommandText 2 Klammern vergessen:
// Gamemode v0.1
// by LK
#include <a_samp>
#include <dini>
enum info
{
passwort[128], // Passwort
skin, // Skin
};
new pInfo[MAX_PLAYERS] [info];
new bool:loggedin[MAX_PLAYERS];
main()
{
print("\n----------------------------------");
print("Gamemode by LK");
print("----------------------------------\n");
}
stock strget(strx[], pos, search = ' ') {
new arg, ret[128], idxx;
for (new i = 0; i < strlen(strx); i++) {
if(strx[i] == search || i == strlen(strx) || strx[i + 1] == 10) {
arg++;
if (arg == pos + 1){
ret[i-idxx] = EOS;
return ret;
} else if (arg == pos)
idxx= i+1;
}
else if (arg == pos)
ret[i - idxx] = strx[i];
}
return ret;
}
public OnGameModeInit()
{
SetGameModeText("Fun Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
new name[128], save[128]; // Namen und Save Variable
GetPlayerName(playerid, name, sizeof(name)); // Name des Spieler bekommen
format(save, sizeof(save), "/player/%s.ini", name); // Dateinamen bekommen
if (dini_Exists(save))
{
SendClientMessage(playerid, 0x33CCFFAA, "Benutze /login [passwort], um dich einzuloggen");
GivePlayerMoney(playerid, dini_Int(save, "money")); // Spieler das gespeicherte Geld geben
SetPlayerSkin(playerid, dini_Int(save, "skin")); // Spieler das gespeicherte Skin geben
}
else
{
if (!dini_Exists(save))
{
SendClientMessage(playerid, 0x33CCFFA, "Benutze /register [passwort], um dich zu registrieren");
}
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new name[128], save[128]; // Namen und Save Variable
GetPlayerName(playerid, name, sizeof(name)); // Name des Spieler bekommen
format(save, sizeof(save), "/player/%s.ini", name); // Dateinamen bekommen
if (dini_Exists(save))
{
dini_IntSet(save, "money", GetPlayerMoney(playerid)); // speichert aktuelles Geld
dini_IntSet(save, "skin", GetPlayerSkin(playerid)); // speichert aktuellen Skin
}
return 1;
}
public OnPlayerSpawn(playerid)
{
new name[128], save[128];
GetPlayerName(playerid, name, sizeof(name));
format(save, sizeof(save), "/player/%s.ini", name);
if (loggedin[playerid] == false)
{
SendClientMessage(playerid, 0xAA3333AA, "Du musst dich einloggen, bevor du spawnst!");
Kick(playerid);
}
SetPlayerSkin(playerid, dini_Int(save, "skin")); // gespeicherten Skin geben
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new player[MAX_PLAYER_NAME];
// /register [password]
if(strcmp(strget(cmdtext, 0), "/register", true) == 0)
{
new save[40]; // neuen String "save" erstellen
GetPlayerName(playerid, player, sizeof(player));
format(save, sizeof(save), "/player/%s.ini", player); // Speicherort
if (!dini_Exists(save))
{
dini_Create(save); // ini Datei erzeugen
dini_IntSet(save, "password", udb_hash(strget(cmdtext, 1))); // PW in ini verschlüsselt speichern
SendClientMessage(playerid, 0x33AA33AA, "***Account wurde erstellt***");
SendClientMessage(playerid, 0x33AA33AA, "***Du kannst dich nun mit /login (password) anmelden***");
}
else
{
if (dini_Exists(save))
{
SendClientMessage(playerid, 0xAA3333AA, "Der Account ist bereits registriert");
}
}
}
if(strcmp(strget(cmdtext,0), "/login", true) == 0)
{
new save[40], s2[256]; //gleiche wie oben
GetPlayerName(playerid,player,sizeof(player));
format(save,sizeof(save),"player/%s.ini",player);
if(dini_Exists(save)) // wenn Datei existiert
{
s2=dini_Get(save,"passwort"); // lade das Passwort
if(strval(s2)==udb_hash(strget(cmdtext,1))) // wenn die Eingabe nach /login mit dem Passwort von der registration übereinstimmt
{
loggedin[playerid] = true; //sage dem Server, dass der Spieler eingeloggt ist.
SendClientMessage(playerid, 0x33CCFFAA, "***Du hast dich erfolgreich eingeloggt***");
SpawnPlayer(playerid);
}
else // wenn das passwort nicht stimmt
{
SendClientMessage(playerid, 0xAA3333AA, "Passwort Falsch!");
}
}
}
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
stock strget(strx[], pos, search = ' ') {
new arg, ret[128], idxx;
for (new i = 0; i < strlen(strx); i++) {
if(strx[i] == search || i == strlen(strx) || strx[i + 1] == 10) {
arg++;
if (arg == pos + 1){
ret[i-idxx] = EOS;
return ret;
} else if (arg == pos)
idxx= i+1;
}
else if (arg == pos)
ret[i - idxx] = strx[i];
}
return ret;
}