OnPlayerSpawn is not called
#1

Here is my OnPlayerSpawn:

Код:
public OnPlayerSpawn(playerid)
{
    new PlayerName[MAX_PLAYER_NAME],
    string[40];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    format(string, sizeof(string), "%s has spawned successfully.", PlayerName);
    SendClientMessageToAll(0xFFFFFFFF, string);  

	
	SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 1);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 1);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 1);
	
	
	SetPlayerColor(playerid, -1);
	SetPlayerHealth(playerid, 100.0);
	SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
	SetCameraBehindPlayer(playerid);
	StopAudioStreamForPlayer(playerid);

    return 1;
}
It doesnt work, i spawn successfuly but it wont work... I dont get the message and it wont change my skin/color, any of this.
Reply
#2

Add more value for string, exactly 50.

Код:
string[50]
24 (Name player) + 26 (Letters) = 50.
Reply
#3

Quote:
Originally Posted by Fynn.
Посмотреть сообщение
Add more value for string, exactly 50.

Код:
string[50]
24 (Name player) + 26 (Letters) = 50.
that is not the problem, it wont execute any of the instructions
Reply
#4

Use the functions at OnPlayerConnect, only the message is ok.
Reply
#5

Quote:
Originally Posted by Yuri8
Посмотреть сообщение
Use the functions at OnPlayerConnect, only the message is ok.
i need to set health, skin, weaponskill, stop audio stream every time when player spawn, that will not solve anything..
Reply
#6

Swap the order of these things, like this:

Код:
public OnPlayerSpawn(playerid)
{
	SetPlayerColor(playerid, -1);
	SetPlayerHealth(playerid, 100.0);
	SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
	SetCameraBehindPlayer(playerid);
	StopAudioStreamForPlayer(playerid);

	SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 1);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 1);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 1);
	SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 1);

	new PlayerName[MAX_PLAYER_NAME],string[51];
	GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
	format(string, sizeof(string), "%s has spawned successfully.", PlayerName);
	SendClientMessageToAll(0xFFFFFFFF, string);  

	return 1;
}
Reply
#7

not working...
Reply
#8

Do you have any runtime error ? Check server log and also run server with crash detect
Reply
#9

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
Do you have any runtime error ? Check server log and also run server with crash detect
i checked server.cfg for crashdetector and i noticed i didn't put .so extension on any plugin i added, thanks for that, helped me, really stupid thing..


now i checked the log and i got 1 runtime error:

[16:30:52] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
Reply
#10

Quote:
Originally Posted by Saddin
Посмотреть сообщение
i checked server.cfg for crashdetector and i noticed i didn't put .so extension on any plugin i added, thanks for that, helped me, really stupid thing..


now i checked the log and i got 1 runtime error:

[16:30:52] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
No AddPlayerClass in OnGameModeInit?
Reply
#11

Quote:
Originally Posted by NaS
Посмотреть сообщение
No AddPlayerClass in OnGameModeInit?
no because i dont want to use those player classes, im making rp kind of script
Reply
#12

Add main(){} to your gm
Reply
#13

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
Add main(){} to your gm
i have that already
Reply
#14

Quote:
Originally Posted by Saddin
Посмотреть сообщение
no because i dont want to use those player classes, im making rp kind of script
You need to add classes (1 at least to be exact), there is no way around that!

What you mean is probably UsePlayerPedAnims (which affects the movement style of all skins)?
Reply
#15

Quote:
Originally Posted by NaS
Посмотреть сообщение
You need to add classes (1 at least to be exact), there is no way around that!

What you mean is probably UsePlayerPedAnims (which affects the movement style of all skins)?
You are not forced to add any class if you want, it's not needed at all for everything else to work.
Reply
#16

Quote:
Originally Posted by NaS
Посмотреть сообщение
You need to add classes (1 at least to be exact), there is no way around that!

What you mean is probably UsePlayerPedAnims (which affects the movement style of all skins)?
I dont mean that, i know gamemodes that dont have AddPlayerClass and still works, but i dont know whats wrong with this...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)