PDA

View Full Version : Dafuq is the problem, officer?


NuggaN
28/02/2013, 10:41 AM
Inb4 I had a Login BOX where I can login to the server and select an skin and spawn.. now it doesnt come..


I get this screen when I join my own server after adding sscanf and ocmd..

http://www.abload.de/img/era9dds.png

but what can be the cause for that? :S

here my script (selfmade one)
when I compile there aint errors

// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

// COLOURS FOR CLIENTMESSAGES

//PLAYER SPAWN MONEY



#include <a_samp>
#include <dini>
#include <ocmd>
#include <sscanf2>

// HP TIMER//
forward HPTimer(); //forward goes above OnFilterScriptInit()
//

//COLOURS//
#define lightblue 0x007DFFFF
#define green 0x00FF3CFF
#define red 0xF50000FF
#define yellow 0xFFF000FF

//DIALOGES//
#define DIALOG_BSN_EAT 1 // 1 for the first Dialog
#define DIALOG_REGISTER 2 //when connecting
#define DIALOG_LOGIN 3


#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}


public OnFilterScriptExit()
{
return 1;
}

#else
//BurgerShot Nord
new bsnenter;
new bsnexit;
new bsnpickupeat;

//






main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}

#endif




public OnGameModeInit()
{
//PICKUP FOR ENTERING BUILDINGS
//BSN
bsnenter=CreatePickup(1318,1,1199.5436,-918.6185,43.1177);
bsnexit=CreatePickup(1318,1,362.8422,-75.1400,1001.5078);
bsnpickupeat=CreatePickup(1239,1,377.3936,-67.9661,1001.5151);
Create3DTextLabel("Type /get food to eat.",lightblue,377.3936,-67.9661,1001.5151,10,0);
//NO Interiors
DisableInteriorEnterExits();
// Don't use these lines if it's a filterscript
UsePlayerPedAnims();
SetGameModeText("Blank Script");
//------------------------[PLAYER CLASS SELECTION]--------------------------
AddPlayerClass(1,1728.8132,-1111.8784,24.0859,179.3718,0,0,0,0,0,0);
AddPlayerClass(6,1728.8132,-1111.8784,24.0859,179.3718,0,0,0,0,0,0);
AddPlayerClass(7,1728.8132,-1111.8784,24.0859,179.3718,0,0,0,0,0,0);
AddPlayerClass(22,1728.8132,-1111.8784,24.0859,179.3718,0,0,0,0,0,0);
AddPlayerClass(39,1728.8132,-1111.8784,24.0859,179.3718,0,0,0,0,0,0);
AddPlayerClass(101,1728.8132,-1111.8784,24.0859,179.3718,0,0,0,0,0,0);
AddPlayerClass(135,1728.8132,-1111.8784,24.0859,179.3718,0,0,0,0,0,0);
AddPlayerClass(4,1728.8132,-1111.8784,24.0859,179.3718,0,0,0,0,0,0);
AddPlayerClass(5,1728.8132,-1111.8784,24.0859,179.3718,38,600,0,0,0,0);
//---------------------------[SERVER VEHICLES RANDOM FOOR ALL]------------------------------
AddStaticVehicle(429,1232.2089,-925.7410,42.3040,99.1981,14,14);
AddStaticVehicle(481,1735.9449,-1129.8723,23.5980,265.9641,1,1); // SPAWNBIKE 1
AddStaticVehicle(481,1736.6962,-1121.7760,23.6053,357.4325,1,1); // SPAWNBIKE 2
AddStaticVehicle(481,1721.5541,-1120.7041,23.6004,89.8596,1,1); // SPAWNBIKE 3
AddStaticVehicle(481,1721.2747,-1126.9692,23.6023,90.8709,1,1); // SPAWNBIKE 4
AddStaticVehicle(481,1721.2085,-1122.8856,23.6015,83.5050,1,1); // SPAWNBIKE 5
//---------------------------[TIMERS]------------------------------
SetTimer("HPTimer",1000000,1); //interval has to be in milliseconds. and repeating 1 or true
return 1;
}



public OnGameModeExit()
{
return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid,2106.5654,1788.9365,10.6719) ;
SetPlayerFacingAngle(playerid,245.1837);
SetPlayerCameraPos(playerid,2111.6599,1786.5791,10 .6719);
SetPlayerCameraLookAt(playerid,2106.5654,1788.9365 ,10.6719);
return 1;
}

public OnPlayerConnect(playerid)
{
new Spielerdatei[64];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(Spielerdatei,sizeof(Spielerdatei),"/Accounts/%s.txt",name); //s steht für string für spielername
if(dini_Exists(Spielerdatei))
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYL E_INPUT,"Login","Account has been found. Please enter your password.","Login","Cancel");
}
else
{
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_S TYLE_INPUT,"Registering","Choose a password:","Register!","Cancel");
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"%s has joined the server. Welcome!",pName);
SendClientMessageToAll(0xFEFEFEFF,string);
}
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
if(GetPVarInt(playerid,"loggedin")==1)
{
SpielerSpeichern(playerid);//Spieler Speichern
}
return 1;
}

public OnPlayerSpawn(playerid)
{
new Spielerdatei[64];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(Spielerdatei,sizeof(Spielerdatei),"/Accounts/%s.txt",name); //s steht für string für spielername
if(!dini_Exists(Spielerdatei))
{
GivePlayerMoney(playerid,4000);
}
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;
}

//ADMIN Commands

ocmd:kick(playerid,params[]) //kick ist befehl an sich, params ist alles was nach /kick eingegeben wird)
{
new pID, reason[128],string[128]; //spieler ID und Grund für den kick [ ist die größe des textes]
if(sscanf(params,"us",pID,reason))return SendClientMessage(playerid,lightblue,"Usage: /kick [id] [reason]");
format(string,sizeof(string),"AdminCmd: %s was kicked by %s. Reason: %s",SpielerName(pID),SpielerName(playerid),reason);
SendClientMessageToAll(red,string);
Kick(pID);
return 1;
}


public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext,"/restart server",true)==0)
{
if(isPlayerAnAdmin(playerid,3))
{
SendRconCommand("gmx");
return 1;
}
}
if(strcmp(cmdtext,"/golspd",true)==0)
{
if(isPlayerAnAdmin(playerid,3))
{

if(IsPlayerInAnyVehicle(playerid))//Checks if player is in vehilce
{
SetVehiclePos(GetPlayerVehicleID(playerid),1520.08 25,-1698.6149,13.2266);
SendClientMessage(playerid,0x91FF00FF,"You have been teleported to LSPD");
}
else
{
SetPlayerPos(playerid,1520.0825,-1698.6149,13.2266);
SendClientMessage(playerid,0x91FF00FF,"You have been teleported to LSPD");
}
}
return 1;
}
if(strcmp(cmdtext,"/gobsn",true)==0)
{
if(IsPlayerInAnyVehicle(playerid))//Checks if player is in vehilce
{
SetVehiclePos(GetPlayerVehicleID(playerid),1211.96 02,-928.9319,42.5061);
SendClientMessage(playerid,0x91FF00FF,"You have been teleported to BSN");
}
else
{
SetPlayerPos(playerid,1211.9602,-928.9319,42.5061);
SendClientMessage(playerid,0x91FF00FF,"You have been teleported to BSN");
}
return 1;
}
if(strcmp(cmdtext,"/get food",true)==0)
{
if(IsPlayerInRangeOfPoint(playerid,6.0,377.3936,-67.9661,1001.5151))
{
ShowPlayerDialog(playerid,DIALOG_BSN_EAT,DIALOG_ST YLE_MSGBOX,"Special offer of the today:","Our special offer for today is the BIG MAC!\nIt cost's 150$.\nDo you want to buy it?","Buy it!","No, thanks");
}
else
{

}
return 1;
}
if(strcmp(cmdtext,"/stats",true)==0)
{
new string[128];
new fraktname[64];
switch(GetPVarInt(playerid,"Fraktion"))
{
case 0:{fraktname="Keine";}//Wenn fraktion 0 ist
case 1:{fraktname="Fraktname 1";}
case 2:{fraktname="Fraktname 2";}
case 3:{fraktname="Fraktname 3";}
}
//1 Reihe
format(string,sizeof(string),"[Name: %s] [Level: %i] [Adminlevel: %i] [Fraktion: %s]",SpielerName(playerid),GetPlayerScore(playerid),Ge tPVarInt(playerid,"Adminlevel"),fraktname);
SendClientMessage(playerid, lightblue, string);
//2 Reihe
return 1;
}
return 0;
}

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)
{
if(pickupid==bsnenter)
{
SetPlayerPos(playerid,366.7109,-73.7267,1001.5078);
SetPlayerInterior(playerid,10);
GameTextForPlayer(playerid,"~w~You have ~r~entered ~g~the bsn.",3000,5);
}
if(pickupid==bsnexit)
{
SetPlayerPos(playerid,1198.0558,-921.6335,43.0405);
SetPlayerFacingAngle(playerid,154.9663);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid,0);
}
if(pickupid==bsnpickupeat)
{

}
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[])
{
if(dialogid==DIALOG_LOGIN)
{
if(response==0)
{
SendClientMessage(playerid,red,"You have cancelled the process.");
Kick(playerid);
return 1;
}
if(response==1)
{
if(!strlen(inputtext)) // If he is not writing anything..
{
SendClientMessage(playerid, yellow, "Password is too short.");
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYL E_INPUT,"Login","Account has been found. Please enter your password.","Login","Cancel");
return 1;
}
else
{
Login(playerid,inputtext);
return 1;
}
}
}
if(dialogid==DIALOG_REGISTER)
{
if(response==0)
{
SendClientMessage(playerid,red,"You have cancelled the process.");
Kick(playerid);
return 1;
}
if(response==1)
{
if(!strlen(inputtext)) // If he is not writing anything..
{
SendClientMessage(playerid, yellow, "Password is too short.");
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_S TYLE_INPUT,"Registering","Please choose a password:","Register","Cancel"); //to show back dialoge
return 1;
}
else
{
Register(playerid,inputtext);
return 1;
}
}
}
if(dialogid==DIALOG_BSN_EAT)
{
if(response==1)
{
new Float:hp;
GetPlayerHealth(playerid,hp);
if(hp<=99)
{
SendClientMessage(playerid, green, "Thanks for buying it! Enjoy it");
SetPlayerHealth(playerid,hp+17.5);
GivePlayerMoney(playerid,-150);
}
else
{
SendClientMessage(playerid,green,"You are full already!");
}
}
if(response==0)
{

}
}
return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}

// HP TIMER1//
public HPTimer() //Timers are run as publics, required to be forwarded
{
for(new i = 0; i < MAX_PLAYERS; i++) //loops through All players
{
if(IsPlayerConnected(i))//if they are not connected it will not work for them
{
new Float:hptime; //Float for their current hp
GetPlayerHealth(i,hptime);//Get their HP and saves it as the HP FLOAT
SetPlayerHealth(i,hptime -4.00);//Will minus their hp by 4 every 10 sec
}
}
}
//REGISTERING//
stock Register(playerid, key[]) //angeben was angegeben werden muss
{
new Spielerdatei[64];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(Spielerdatei,sizeof(Spielerdatei),"/Accounts/%s.txt",name); //s steht für string für spielername
dini_Create(Spielerdatei);
dini_Set(Spielerdatei,"Password",key);
SendClientMessage(playerid,yellow,"Successfully registered!");
SetPlayerScore(playerid,0); //wollen das er level 0 hatw
SetPVarInt(playerid,"loggedin",1);
return 1;
}
//LOGGIN IN//
stock Login(playerid,key[])
{
new Spielerdatei[64];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(Spielerdatei,sizeof(Spielerdatei),"/Accounts/%s.txt",name); //s steht für string für spielername
if(!strcmp(key,dini_Get(Spielerdatei,"Password"),true)) //überprüft ob key und password übereinstimme bei false achtet auf groß und kleinund groß schreibung
{
LoadAccount(playerid);
SendClientMessage(playerid,yellow,"Successful login");
return 1;
}
else
{
SendClientMessage(playerid, red, "Wrong password.");
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYL E_INPUT,"Login","Account has been found. Please enter your password.","Login","Cancel");
return 1;
}
}

stock LoadAccount(playerid)
{
new Spielerdatei[64];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(Spielerdatei,sizeof(Spielerdatei),"/Accounts/%s.txt",name); //
SetPlayerScore(playerid,dini_Int(Spielerdatei,"Level")); //Score wird zurückgesetzt
GivePlayerMoney(playerid,dini_Int(Spielerdatei,"Geld"));
SetPVarInt(playerid,"Adminlevel",dini_Int(Spielerdatei,"Adminlevel"));
SetPVarInt(playerid,"Fraktion",dini_Int(Spielerdatei,"Fraktion"));
SetPVarInt(playerid,"loggedin",1);
//SpielerInfo[playerid][Adminlevel]=dini_Int(Spielerdatei,"Adminlevel"); //gespeichert und ausgelesen
//SpielerInfo[playerid][Fraktion]=dini_Int(Spielerdatei,"Fraktion");
return 1;
}

stock SpielerSpeichern(playerid)
{
new Spielerdatei[64];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(Spielerdatei,sizeof(Spielerdatei),"/Accounts/%s.txt",name);
dini_IntSet(Spielerdatei,"Level",GetPlayerScore(playerid));
dini_IntSet(Spielerdatei,"Geld",GetPlayerMoney(playerid));
dini_IntSet(Spielerdatei,"Adminlevel",GetPVarInt(playerid,"Adminlevel"));
dini_IntSet(Spielerdatei,"Fraktion",GetPVarInt(playerid,"Fraktion"));
return 1;
}

stock isPlayerAnAdmin(playerid, rang)
{
if(GetPVarInt(playerid,"Adminlevel")>=rang)return 1;
return 0;
}

stock SpielerName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
return name;
}

RajatPawar
28/02/2013, 10:44 AM
Why do you have OnFilterScript()it and OnGameMode()it both?

NuggaN
28/02/2013, 10:52 AM
Why do you have OnFilterScript()it and OnGameMode()it both?

Why not, aint it allowed? If you use the standard script (Pawn.exe>New>) you'll get this too