SA-MP Forums Archive
How to use params in strcmp - 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: How to use params in strcmp (/showthread.php?tid=403316)



How to use params in strcmp - mickos - 29.12.2012

Hey guys,

I need to know how I can use params in strcmp. I know how to use it in zcmd, but.. Not with strcmp.

With ZCMD you can do it so..

pawn Код:
CMD:pm(playerid, params[])
    {
Very easy to know.. But with strcmp is it different and I dont know how to do that..

pawn Код:
if (strcmp("/pm", cmdtext, true, 10) == 0)
    {
See? the params didnt in there, that gives me errors:

pawn Код:
F:\GTA San Andreas\Freeroam Server\pawno\Untitled2.pwn(62) : warning 201: redefinition of constant/macro (symbol "pInfo")
F:\GTA San Andreas\Freeroam Server\pawno\Untitled2.pwn(1208) : error 029: invalid expression, assumed zero
F:\GTA San Andreas\Freeroam Server\pawno\Untitled2.pwn(1208) : warning 215: expression has no effect
F:\GTA San Andreas\Freeroam Server\pawno\Untitled2.pwn(1208) : warning 215: expression has no effect
F:\GTA San Andreas\Freeroam Server\pawno\Untitled2.pwn(1208) : error 029: invalid expression, assumed zero
F:\GTA San Andreas\Freeroam Server\pawno\Untitled2.pwn(1208) : error 029: invalid expression, assumed zero
F:\GTA San Andreas\Freeroam Server\pawno\Untitled2.pwn(1208) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
This is line 1208:

pawn Код:
if(sscanf(params, "us[128]", id, params)) return SendClientMessage(playerid, COLOR_RED, "Syntax: /pm (id) (text)");
I hope anyone can tell me more about this..

Thank you guys


Re: How to use params in strcmp - mickos - 29.12.2012

Quote:
Originally Posted by ******
Посмотреть сообщение
Why do you need to use it with strcmp if you can already use ZCMD? The latter was made to replace the former.
Because zcmd doesnt work by me, I have test simly ZCMD commands that are examples to, in my server, but I get all the time: SERVER:UNKNOWN COMMAND.


Re: How to use params in strcmp - Mr.Anonymous - 29.12.2012

Quote:
Originally Posted by mickos
Посмотреть сообщение
Because zcmd doesnt work by me, I have test simly ZCMD commands that are examples to, in my server, but I get all the time: SERVER:UNKNOWN COMMAND.
Can you show us the command please.


Re: How to use params in strcmp - mickos - 29.12.2012

Okee

Quote:

#if PMSYSTEM == true
CMDm(playerid, params[])
{
new id, str[128], ip[16];
if(sscanf(params, "us[128]", id, params)) return SendClientMessage(playerid, COLOR_RED, "Syntax: /pm (id) (text)");
if(id == INVALID_PLAYER_ID) return ErrorMessages(playerid, 2);
if(id == playerid) return ErrorMessages(playerid, 4);
if(PlayerAcc[id][Mute] == 1) return SendClientMessage(playerid, COLOR_RED, "That player is mute (Unable to PM)");
if(PlayerAcc[playerid][Mute] == 1) return SendClientMessage(playerid, COLOR_RED, "You cannot PM while you are silence!");
if(PlayerAcc[id][BlockPM] == 1) return SendClientMessage(playerid, COLOR_RED, "That player has block Private Message system!");
GetPlayerIp(playerid, ip, sizeof(ip));
#if AntiAd == true
if(stringContainsIP(params))
{
new msg[300];
format(msg, sizeof(msg), "%s(%d) has been kicked by MAdmin (Reason: Server Advertisement via PM) [Kicked Player IP: %s]", GetName(playerid), playerid, ip);
SaveIn("AdKick", msg);
format(str, sizeof(str), "Kick: %s(%d) has been kicked by MAdmin (Reason: Server Advertisement via PM)", GetName(playerid), playerid);
SendClientMessageToAll(COLOR_GREY, str);
SendClientMessage(playerid, COLOR_RED, "You are kicked by MAdmin (Reason: Server Advertisement via PM)");
Kick(playerid);
return 0;
}




Re: How to use params in strcmp - Mr.Anonymous - 29.12.2012

What is the problem in there?


Re : Re: How to use params in strcmp - [HRD]Mar1 - 29.12.2012

Quote:
Originally Posted by mickos
Посмотреть сообщение
Okee
Use return 1;


Re: How to use params in strcmp - mickos - 30.12.2012

I don't want to use ZCMD!! I want to use strcmp.. Please tell me how to use params with strcmp