14.03.2010, 17:45
Hey. I was scripting on a inc file. Which is my first time so im just alittle lost.
So i made this
Then i made some commands to test it
Now there should also be this thing sending me a message every time level changes
Now all this gives no errors. But i recieve "SERVER: Unknown command" each time it is supposed to change level. Plus that GivePlayerXP(playerid,10);
6 times sets hes XP to 60 where it is supposed to be 0 and level should be 1. And when i get this unknown command thing just 1 more XP levels up
Hope you get my point
So i made this
pawn Код:
public xpc(playerid)
{
new xpcheck = xp[playerid]-60;
if(xpcheck >= 0)
{
new oldlevel = level[playerid];
level[playerid]++;
OnPlayerLevelChange(playerid,level[playerid],oldlevel);
return 1;
}
else if(xpcheck <= -60)
{
new oldlevel = level[playerid];
level[playerid]--;
OnPlayerLevelChange(playerid,level[playerid],oldlevel);
return 1;
}
}
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
ShowStatusForPlayer(playerid);
return 1;
}
if (strcmp("/givemelevel", cmdtext, true, 10) == 0)
{
GivePlayerXP(playerid,60);
return 1;
}
if (strcmp("/givemexp", cmdtext, true, 10) == 0)
{
GivePlayerXP(playerid,10);
return 1;
}
return 0;
}
pawn Код:
public OnPlayerLevelChange(playerid,newlevel,oldlevel)
{
SendClientMessage(playerid,0xFFFFFF,"Level changed!");
return 1;
}
6 times sets hes XP to 60 where it is supposed to be 0 and level should be 1. And when i get this unknown command thing just 1 more XP levels up
Hope you get my point