PDA

View Full Version : Mysql Update interior


cyberlord
23/12/2014, 02:34 PM
Hello i am try to update interior id on player disconnect but got two error not sure why i am using mysql 39-r2 please help
this is how its look errors
C:\Users\Cyberlord\Desktop\samp server stuff\Samp Server R4\gamemodes\RP.pwn(640) : error 075: input line too long (after substitutions)
C:\Users\Cyberlord\Desktop\samp server stuff\Samp Server R4\gamemodes\RP.pwn(641 -- 642) : error 017: undefined symbol "id"

and this is my disconnect callback

public OnPlayerDisconnect(playerid, reason)
{
new query[500], Float:pos[4];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
GetPlayerFacingAngle(playerid, pos[3]);
new Interior = GetPlayerInterior(playerid);
mysql_format(sqlconnect, query, sizeof(query), "UPDATE `accounts` SET `Admin`=%d, `Vip`=%d, `Exp`=%d, `Money`=%d, `pHealth`=%d, `RobExp`=%d, `WantedLevel`=%d, `InteriorID`=%d, `posX`=%f, `posY`=%f, `posZ`=%f, `posA`=%f WHERE `ID`=%d",\
PlayerInfo[playerid][Admin], PlayerInfo[playerid][Vip], PlayerInfo[playerid][Exp], PlayerInfo[playerid][Money], PlayerInfo[playerid][pHealth], PlayerInfo[playerid][RobExp], PlayerInfo[playerid][WantedLevel], Interior, pos[0], pos[1], pos[2], pos[3], PlayerInfo[playerid][ID]);
mysql_tquery(sqlconnect, query, "", "");



return 1;
}

Vince
23/12/2014, 03:33 PM
Well, it says your line is too long. You need to shorten it or find a way to circumvent the problem. But honestly, why do you need to save admin level and vip expiry date every time? How many times do these things change? Update these values immediately in the event they do change.

cyberlord
23/12/2014, 03:50 PM
yes i have thinked about cuz now this line is taken from tut and i leave like it was ,so basicly i need update only those things witch are change alot times right like pos,angle, interiorid,world, , and about second error its the same reason fot him ?

cyberlord
23/12/2014, 05:21 PM
okay i solve with those eror but probelem still same if i enter in some interior and then quit game onplayerdissconnect save my pos and interior but when reconect start falling from that interior please help


Update on disconnect :
public OnPlayerDisconnect(playerid, reason)
{
new query[500], Float:pos[4];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
GetPlayerFacingAngle(playerid, pos[3]);
new Interior = GetPlayerInterior(playerid);
new world = GetPlayerVirtualWorld(playerid);
mysql_format(sqlconnect, query, sizeof(query), "UPDATE `accounts` SET `Exp`=%d, `Money`=%d, `pHealth`=%d, `WantedLevel`=%d, `InteriorID`=%d, `World`=%d, `posX`=%f, `posY`=%f, `posZ`=%f, `posA`=%f WHERE `ID`=%d",\
PlayerInfo[playerid][Exp], PlayerInfo[playerid][Money], PlayerInfo[playerid][pHealth], PlayerInfo[playerid][WantedLevel], Interior, world, pos[0], pos[1], pos[2], pos[3], PlayerInfo[playerid][ID]);
mysql_tquery(sqlconnect, query, "", "");



return 1;
}

load on connect :
public OnAccountLoad(playerid)
{

PlayerInfo[playerid][Admin] = cache_get_field_content_int(0, "Admin");
PlayerInfo[playerid][Vip] = cache_get_field_content_int(0, "Vip");
PlayerInfo[playerid][Exp] = cache_get_field_content_int(0, "Exp");
PlayerInfo[playerid][Money] = cache_get_field_content_int(0, "Money");
PlayerInfo[playerid][JobLevel] = cache_get_field_content_int(0, "JobLevel");
PlayerInfo[playerid][JobID] = cache_get_field_content_int(0, "JobID,");
PlayerInfo[playerid][Skin] = cache_get_field_content_int(0, "Skin");
PlayerInfo[playerid][JobSkin] = cache_get_field_content_int(0, "JobSkin");
PlayerInfo[playerid][pTut] = cache_get_field_content_int(0, "pTut");
PlayerInfo[playerid][pSex] = cache_get_field_content_int(0, "pSex");
PlayerInfo[playerid][pAge] = cache_get_field_content_int(0, "pAge");
PlayerInfo[playerid][pHealth] = cache_get_field_content_int(0, "pHealth");
PlayerInfo[playerid][pArmor] = cache_get_field_content_int(0, "pArmor");
PlayerInfo[playerid][WantedLevel] = cache_get_field_content_int(0, "WantedLevel");
PlayerInfo[playerid][posX] = cache_get_field_content_float(0, "posX");
PlayerInfo[playerid][posY] = cache_get_field_content_float(0, "posY");
PlayerInfo[playerid][posZ] = cache_get_field_content_float(0, "posZ");
PlayerInfo[playerid][posA] = cache_get_field_content_float(0, "posA");
PlayerInfo[playerid][RobExp] = cache_get_field_content_int(0, "RobExp");
PlayerInfo[playerid][Teorija] = cache_get_field_content_int(0, "Teorija");
PlayerInfo[playerid][InteriorID] = cache_get_field_content_int(0, "InteriorID");
PlayerInfo[playerid][World] = cache_get_field_content_int(0, "World");

GivePlayerMoney(playerid, PlayerInfo[playerid][Money]);
SendClientMessage(playerid, -1, "Sekmingai prisijungete");


return 1;
}



and on player spawn :
public OnPlayerSpawn(playerid)
{

SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][World]);
SetPlayerInterior(playerid, PlayerInfo[playerid][InteriorID]);
SetPlayerFacingAngle(playerid, PlayerInfo[playerid][posA]);
SetPlayerPos(playerid, PlayerInfo[playerid][posX], PlayerInfo[playerid][posY], PlayerInfo[playerid][posZ]);

return 1;
}

TakeiT
23/12/2014, 05:24 PM
Add a 2 second timer to freeze the player to load mapping. If you are still having trouble, raise the timer a bit.

public OnPlayerSpawn(playerid)
{
TogglePlayerControllable(playerid, 0);
SetTimerEx("UnfreezePlayer", 2000, false, "i", playerid);
}

forward UnfreezePlayer(playerid);
public UnfreezePlayer(playerid)
{
TogglePlayerControllable(playerid, true);
return 1;
}

cyberlord
23/12/2014, 06:13 PM
Add a 2 second timer to freeze the player to load mapping. If you are still having trouble, raise the timer a bit.

public OnPlayerSpawn(playerid)
{
TogglePlayerControllable(playerid, 0);
SetTimerEx("UnfreezePlayer", 2000, false, "i", playerid);
}

forward UnfreezePlayer(playerid);
public UnfreezePlayer(playerid)
{
TogglePlayerControllable(playerid, true);
return 1;
}

this works int hold player for 2 or i set to 4 sec but still nothing loads around and after 4 sec u start fall

cyberlord
23/12/2014, 09:56 PM
some1 please help

cyberlord
24/12/2014, 08:10 PM
still need help with this problem please