PDA

View Full Version : Need help with my script :/


xZer0x23
05/05/2012, 10:12 AM
Hey Guys,
I need help. I want to make a shop, where you can put /changeskin and you come to the Class Selection where you can switch with <- and -> to get your skin. Also, I'd like the skin to be saved with dini, so the player has it, when he logs in another time. But I have some problems because I bypassed the normal ClassSelection after login with

public OnPlayerRequestClass(playerid, classid)
{
SetSpawnInfo(playerid,0,0,1565.0913,-1542.6582,13.5469,178.3392,0,0,0,0,0,0);
SpawnPlayer(playerid);
return 1;
}

So, my problem is, when the player typed /changeskin in the shop, nothing will happen because RequestClass is bypassed, right?
The command I'm talking of:
if(strcmp(cmdtext,"/changeskin",true)==0)
{
IsPlayerInRangeOfPoint(playerid,3,-18.2402,-55.5312,1003.5469);
{
//There is nothing till now, cuz Idk what to put.
return 1;
}
}


My Stocks:
stock Register(playerid,key[])
{
new Spielerdatei[64];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
format(Spielerdatei,sizeof(Spielerdatei),"/Accounts/%s.txt",name);
dini_Create(Spielerdatei);
dini_Set(Spielerdatei,"Passwort",key);
SendClientMessage(playerid,ORANGE,"Registration validated.");
SetPlayerScore(playerid,0);
SetPVarInt(playerid,"loggedin",1);
return 1;
}

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);
if(!strcmp(key,dini_Get(Spielerdatei,"Passwort"),false))
{
LoadAccount(playerid);
SendClientMessage(playerid,ORANGE,"Logged in sucessfully");
SetPVarInt(playerid,"loggedin",1);
return 1;
}
else
{
SendClientMessage(playerid,ORANGE,"Wrong Password.");
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYL E_INPUT,"Login","Your acc was found. Please insert your password.","Login","Abbrechen");
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"));
GivePlayerMoney(playerid,dini_Int(Spielerdatei,"Money"));
SetPVarInt(playerid,"Adminlevel",dini_Int(Spielerdatei,"Adminlevel"));
SetPVarInt(playerid,"Fraktion",dini_Int(Spielerdatei,"Fraktion"));
SetPVarInt(playerid,"Baned",dini_Int(Spielerdatei,"Baned"));
if(GetPVarInt(playerid,"Baned")==1)
{
SendClientMessage(playerid,RED,"Owned! Du bist gebannt =D Selbst schuld!");
Kick(playerid);
}
SetPVarInt(playerid,"loggedin",1);
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,"Money",GetPlayerMoney(playerid));
dini_IntSet(Spielerdatei,"Adminlevel",GetPVarInt(playerid,"Adminlevel"));
dini_IntSet(Spielerdatei,"Fraktion",GetPVarInt(playerid,"Fraktion"));
return 1;
}
EDIT: Another problem would be, even if the Skin is saved with dini, the SetPlayerSpawn info would load the Spawn with the skin 0 as I typed. Is there a way to do
{
SetSpawnInfo(playerid,0,dini_IntSet("Skin",skinID),1565.0913,-1542.6582,13.5469,178.3392,0,0,0,0,0,0);
SpawnPlayer(playerid);
return 1;
}
or something like that?
Thanks for your help :)