13.05.2011, 20:30
Hello, well, I was working on my script, and I hadn't tested it for a couple days so I expected to have big changes, however when I log in I find out for my surprise that I spawn in the middle of the map, CJ skin, no weapons, anything..
Okay so, I was like desperate trying alternate methods trying to figure my mistake, when I tried to debug it adding printf in every line that does something and when I check the RCON console it's blank. Nothing printed.
My conclusions? OnPlayerSpawn is not being called, however it's very important for me as it gives weapons, skin, spawn, and important aspects.
P.S: I don't know if this helps, but I changed my includes to another ones who a friend I'm working who gave me and their different.
And if you want the code...
To make the thing harder, the callback is technically being called untill a point, which appears to be to the mesage 'Start running, you are the manhunt victim!'. The rest (giving weapons, skin, position) is not working or prints anything.
Cheers.
Okay so, I was like desperate trying alternate methods trying to figure my mistake, when I tried to debug it adding printf in every line that does something and when I check the RCON console it's blank. Nothing printed.
My conclusions? OnPlayerSpawn is not being called, however it's very important for me as it gives weapons, skin, spawn, and important aspects.
P.S: I don't know if this helps, but I changed my includes to another ones who a friend I'm working who gave me and their different.
And if you want the code...
pawn Код:
public OnPlayerSpawn(playerid)
{
new
szString[128],
iWeaponToGive,
iSecondWepToGive,
iThirdWepToGive,
iFourthWepToGive;
if (iHunt == -1)
{
AssignManhunt();
}
if (iHunt != playerid)
{
format(szString, 128, "{FF9900}The manhunt victim is %s(%d), kill him to get $%d and %d score!", GetName(iHunt), iHunt, iMoneyReward, iScoreReward);
SendClientMessageToAll(-1, szString);
}
if (iHunt == playerid)
{
SetPlayerColor(playerid, 0xFF0000FF);
SendClientMessage(playerid, -1, "{FF0000}Start running, you are the manhunt victim!");
}
if (iHunt != playerid)
{
switch (GetPVarInt(playerid, "Score"))
{
case 0..15:
{
iWeaponToGive = 23;
iSecondWepToGive = 25;
}
case 16..70:
{
iWeaponToGive = 22;
SetPlayerSkillLevel(playerid, 0, 400);
iSecondWepToGive = 29;
}
case 71..120:
{
iWeaponToGive = 24;
iSecondWepToGive = 26;
SetPlayerSkillLevel(playerid, 4, 1);
}
case 121..170:
{
iWeaponToGive = 24;
iSecondWepToGive = 31;
}
default:
{
iWeaponToGive = 24;
iSecondWepToGive = 31;
iThirdWepToGive = 27;
}
}
if (GetPVarInt(playerid, "Premium") == 1)
{
iFourthWepToGive = 16;
}
if (iFourthWepToGive > 0)
{
GiveWeapon(playerid, iFourthWepToGive, 15);
}
if (iThirdWepToGive > 0)
{
GiveWeapon(playerid, iThirdWepToGive, 150);
}
GiveWeapon(playerid, iWeaponToGive, 200);
GiveWeapon(playerid, iSecondWepToGive, 200);
}
else
{
iWeaponToGive = 9;
iSecondWepToGive = 22;
GiveWeapon(playerid, iWeaponToGive, 1);
GiveWeapon(playerid, iSecondWepToGive, 500000);
}
new iRandom = random(sizeof(RandomSpawn));
SetPlayerPos(playerid, RandomSpawn[iRandom][0], RandomSpawn[iRandom][1],RandomSpawn[iRandom][2]);
SetPlayerSkin(playerid, GetPVarInt(playerid, "Skin"));
return true;
}
Cheers.