SA-MP Forums Archive
Mysql Update interior - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Mysql Update interior (/showthread.php?tid=552265)



Mysql Update interior - cyberlord - 23.12.2014

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;
}



Re: Mysql Update interior - Vince - 23.12.2014

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.


Re: Mysql Update interior - cyberlord - 23.12.2014

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 ?


Re: Mysql Update interior - cyberlord - 23.12.2014

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;
}



Re: Mysql Update interior - TakeiT - 23.12.2014

Add a 2 second timer to freeze the player to load mapping. If you are still having trouble, raise the timer a bit.

pawn Код:
public OnPlayerSpawn(playerid)
{
    TogglePlayerControllable(playerid, 0);
    SetTimerEx("UnfreezePlayer", 2000, false, "i", playerid);
}

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



Re: Mysql Update interior - cyberlord - 23.12.2014

Quote:
Originally Posted by TakeiT
Посмотреть сообщение
Add a 2 second timer to freeze the player to load mapping. If you are still having trouble, raise the timer a bit.

pawn Код:
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


Re: Mysql Update interior - cyberlord - 23.12.2014

some1 please help


Re: Mysql Update interior - cyberlord - 24.12.2014

still need help with this problem please