09.06.2010, 15:24
I've got a problem. Basically, I would like to save a players HeX colour to their account when they leave or w/e but every time I try to save it it doesn't work. Is there something I need to do?
CMD:spawncolour(playerid,params[])
{
if(PlayerInfo[playerid][LoggedIn] == 1)
{
if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
{
new pID, colour;
if(sscanf(params, "ux", pID, colour)) return SendClientMessage(playerid, Red, "USAGE: /spawncolour [playerid] [code]");
if(IsPlayerConnected(pID))
{
if(PlayerInfo[pID][LoggedIn] && PlayerInfo[pID][Registered] && IsPlayerVIP(pID))
{
dUserSetINT(PlayerName2(pID)).("SpawnColour", colour);
PlayerInfo[pID][SpawnColour] = dUserINT(PlayerName2(pID)).("SpawnColour");
SetPlayerColor(playerid, PlayerInfo[pID][SpawnColour]);
SendClientMessage(playerid,MANAGEMENT, "*** Spawncolour for this player successfully set");
return 1;
}
else return SendClientMessage(playerid,red,"ERROR: Player must be registered, logged in and be a V.I.P.");
}
else
{
if(udb_Exists(pName(pID)))
{
SendClientMessage(playerid,MANAGEMENT, "*** Spawncolour for this player successfully set");
dUserSetINT(PlayerName2(pID)).("SpawnColour", colour);
return 1;
}
else return SendClientMessage(playerid, red, "A player database with that name was not found.");
}
}
return 0;
}
else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}
[/code]
Originally Posted by _❼_
I have written it so that if the player is not connected it will check for a user database to write in,
|
CMD:spawncolour(playerid,params[]) { if(PlayerInfo[playerid][LoggedIn] == 1) { if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid)) { new pID, colour; if(sscanf(params, "ux", pID, colour)) return SendClientMessage(playerid, Red, "USAGE: /spawncolour [playerid] [colorcode]"); if(IsPlayerConnected(pID)) { if(PlayerInfo[pID][LoggedIn] && PlayerInfo[pID][Registered] && IsPlayerVIP(pID)) { dUserSetINT(PlayerName2(pID)).("SpawnColour", colour); PlayerInfo[pID][SpawnColour] = dUserINT(PlayerName2(pID)).("SpawnColour"); SetPlayerColor(playerid, PlayerInfo[pID][SpawnColour]); SendClientMessage(playerid,MANAGEMENT, "*** Spawncolour for this player successfully set"); } else return SendClientMessage(playerid,red,"ERROR: Player must be registered, logged in and be a V.I.P."); } else { if(udb_Exists(pName(pID))) { SendClientMessage(playerid,MANAGEMENT, "*** Spawncolour for this player successfully set"); dUserSetINT(PlayerName2(pID)).("SpawnColour", colour); } else return SendClientMessage(playerid, red, "A player database with that name was not found."); } } else return SendClientMessage(playerid,0xffffffaa,"You are not authorised to use this command."); } else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands"); }