SA-MP Forums Archive
Help me. again. again. - 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: Help me. again. again. (/showthread.php?tid=657534)



Help me. again. again. - Wreeper - 10.08.2018

I made a zcmd command and one public OnPlayerCommandText();.
Commands from OnPlayerCommandText doesn't work but the ZCMD commands works.
I want to make OnPlayerCommandText commands work too.


Index:

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/000", cmdtext, true) == 0){
{
SetTimer("---", 100, 0);
}
return 1;
}

Finish:

if (strcmp("/fuck", cmdtext, true) == 0){
SetPlayerScore(playerid, -1);
}
return 1;
}

stock GetName(playerid) {
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}

CMD:bonus(playerid, params[]) {
new string[128], rand = 1000 + random(8000);
format(string, sizeof(string), "Felicitari %s. Ai castigat $%d.", GetName(playerid), rand);
SendClientMessage(playerid, 0x4AAB1DFF, string);
GivePlayerMoney(playerid, rand);
return 1;
}



anything wrong? i hidden some with - cuz of privacy


Re: Help me. again. again. - Wreeper - 10.08.2018

Quote:
Originally Posted by ******
Посмотреть сообщение
Just use zcmd, you can't use both.
Someone used them both.
How?
And how do i transform them?


Re: Help me. again. again. - GRiMMREAPER - 10.08.2018

You don't use OnPlayerCommandText if you use ZCMD*. Just port over your code from the callback and make it a command:

pawn Код:
CMD:000(playerid, params[])
{
    SetTimer("---", 100, 0);
    return 1;
}
pawn Код:
CMD:fuck(playerid, params[])
{
    SetPlayerScore(playerid, GetPlayerScore(playerid) - 1);
    return 1;
}
SetPlayerScore(playerid, -1) will not work if you want to deduce 1 point from the player's score.

* Important: Since v0.3 OnPlayerCommandText cannot be used anymore (also ZCMD_NO_CALLBACK option has been removed), but there are two new callbacks instead:


EDIT: ****** was faster, sorry.