Vice City: Multiplayer

VC:MP Discussion => Support => Topic started by: AroliS^ on Nov 11, 2018, 04:55 AM

Title: PlayerClass and SQLQuery problem
Post by: AroliS^ on Nov 11, 2018, 04:55 AM
so, my problem is the next one, blank server.
i already maked my playerclass,
and did my first class to try it

(https://1.bp.blogspot.com/-bWVdhflOEJ0/W-e0xoIZL5I/AAAAAAAAAyA/QU1-R8-aU0Y0a8bxP7Vjj1vJlj53yZSLwCLcBGAs/s1600/playerstats.PNG)

but my playerclass is not recognized


(https://3.bp.blogspot.com/--huqw8rS6T4/W-ezzGJp2NI/AAAAAAAAAx0/PtIg8IGujeI9dcU7wCSX2R2M5JTZHA2LQCLcBGAs/s1600/battle.PNG)

same happened with my SQLQuery isn't recognized what can i do??
function tablescreator()
{
QuerySQL( db, blah blah)");
}
Title: Re: PlayerClass and SQLQuery problem
Post by: Mötley on Nov 11, 2018, 05:17 AM
Account <- array(GetMaxPlayers());

class PlayerClass {
  battle = false;
}

function onPlayerJoin(player) {
  Account[player.ID] = PlayerClass();
}

function onPlayerPart(player, reason) {
  Account[player.ID] = null;
}

Not tested, assuming it's the right syntax. You should be good to go.

Ehh since you only have one post and your using the usual playerclass name from fuzzie.

Usage:
Account[player.ID].battle = false;
Title: Re: PlayerClass and SQLQuery problem
Post by: AroliS^ on Nov 11, 2018, 05:23 AM
same problem, playerclass isn't recognized
Title: Re: PlayerClass and SQLQuery problem
Post by: Mötley on Nov 11, 2018, 01:33 PM
You must be doing something wrong.. Did you use the two examples on the events above?

Make sure there all running on the same vm, it won't work on two separate scripts without something like dofile. Also like the two examples, make sure you don't have double events going on, an example:

function onPlayerJoin(player) {
  MessagePlayer("Welcome to the server", player);
}

function onPlayerJoin(player) {
  Account[player.ID] = PlayerClass();
}
Doing so and for instance the second one will not get called, only way would be if there on a separate vm in this case
Title: Re: PlayerClass and SQLQuery problem
Post by: D4rkR420R on Nov 11, 2018, 04:14 PM
Let's see your onPlayerSpawn function.
Title: Re: PlayerClass and SQLQuery problem
Post by: AroliS^ on Nov 11, 2018, 05:44 PM
this is what i have in my playerspawn

(https://3.bp.blogspot.com/-eCy0FuLY7AA/W-honpgBQbI/AAAAAAAAAy8/8LPbsIpE67w_KUNJX0bedQCswdvcmXrHACLcBGAs/s1600/battle%2Bfunction.PNG)

Motley i else have just two and it doesnt work!!
Title: Re: PlayerClass and SQLQuery problem
Post by: Kelvin Garcia Mendoza on Nov 11, 2018, 07:41 PM
Quote from: AroliS^ on Nov 11, 2018, 05:44 PMthis is what i have in my playerspawn

(https://3.bp.blogspot.com/-eCy0FuLY7AA/W-honpgBQbI/AAAAAAAAAy8/8LPbsIpE67w_KUNJX0bedQCswdvcmXrHACLcBGAs/s1600/battle%2Bfunction.PNG)

Motley i else have just two and it doesnt work!!

Debes tener algo asi en los siguientes 'events':

En onScriptLoad()
pstatus <- array( GetMaxPlayers(), null );
En onPlayerJoin( player )
pstatus[ player.ID ] = PlayerClass();
Y en onPlayerPart( player, reason )
pstatus[ player.ID ] = null;
Y la 'class' obviamente también tiene que estar creada.
Más o menos como te lo explicó @Motley

Si aún nada de esto funciona deberías asegurarte que tu servidor tiene todos los plugins necesarios (también revisa server.cfg).
Title: Re: PlayerClass and SQLQuery problem
Post by: D4rkR420R on Nov 11, 2018, 11:08 PM
Quote from: =TRC=Kelvin on Nov 11, 2018, 07:41 PM
Quote from: AroliS^ on Nov 11, 2018, 05:44 PMthis is what i have in my playerspawn

(https://3.bp.blogspot.com/-eCy0FuLY7AA/W-honpgBQbI/AAAAAAAAAy8/8LPbsIpE67w_KUNJX0bedQCswdvcmXrHACLcBGAs/s1600/battle%2Bfunction.PNG)

Motley i else have just two and it doesnt work!!

Debes tener algo asi en los siguientes 'events':

En onScriptLoad()
pstatus <- array( GetMaxPlayers(), null );
En onPlayerJoin( player )
pstatus[ player.ID ] = PlayerClass();
Y en onPlayerPart( player, reason )
pstatus[ player.ID ] = null;
Y la 'class' obviamente también tiene que estar creada.
Más o menos como te lo explicó @Motley

Si aún nada de esto funciona deberías asegurarte que tu servidor tiene todos los plugins necesarios (también revisa server.cfg).

Como cres el te va entender? How do you think he'll understand you? :c
Title: Re: PlayerClass and SQLQuery problem
Post by: AroliS^ on Nov 12, 2018, 01:34 AM
it is working, thank u so much to you guys xd :D