I need a warn cmd -
dillo1000 - 10.08.2011
I need a str cmd warn command anyone help me out?
Re: I need a warn cmd -
Jafet_Macario - 10.08.2011
pawn Код:
if(strcmp(cmd, "/warn", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, YOURCOLOR, "USAGE: /warn [playerid/PartOfName] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, YOURCOLOR, "USAGE: /warn [playerid/PartOfName] [reason]");
return 1;
}
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "You warned %s, reason: %s", giveplayer, (result));
SendClientMessage(playerid, COLOR_YOURCOLOR, string);
format(string, sizeof(string), "You were warned by %s, reason: %s", sendername, (result));
SendClientMessage(giveplayerid, COLOR_YOURCOLOR, string);
format(string, sizeof(string), "AdmCmd: %s was warned by %s, reason: %s", giveplayer, sendername, (result));
SendClientMessageToAll(0xE42217FF, string);
format(string, sizeof(string), "AdmCmd: %s was warned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
return 1;
}
}//not connected
}
else
{
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, YOURCOLOR, string);
}
}
return 1;
}
And change YOURCOLOR to the colors you want.
Re: I need a warn cmd -
dillo1000 - 10.08.2011
pWarns?
Re: I need a warn cmd -
dillo1000 - 10.08.2011
C:\Users\Mike\Documents\Backup\gamemodes\eR.pwn(51 57) : error 017: undefined symbol "pWarns"
C:\Users\Mike\Documents\Backup\gamemodes\eR.pwn(51 60) : error 017: undefined symbol "string"
C:\Users\Mike\Documents\Backup\gamemodes\eR.pwn(51 60) : error 017: undefined symbol "string"
C:\Users\Mike\Documents\Backup\gamemodes\eR.pwn(51 60) : error 029: invalid expression, assumed zero
C:\Users\Mike\Documents\Backup\gamemodes\eR.pwn(51 60) : fatal error 107: too many error messages on one line
Sorry double post
Re: I need a warn cmd -
Riddick94 - 10.08.2011
Okey wait.. maybe you wan't this make easier, faster, better than strcmp? i can help you but you just need to be better than other what using strcmp. It's really easy to use ZCMD, Sscanf, enum. Wan't my help? Or you for real wan't this strcmp?
Re: I need a warn cmd -
Jafet_Macario - 10.08.2011
under public onplayercommandtext.
Or better take Riddick's advice.
Re: I need a warn cmd -
dillo1000 - 10.08.2011
Yer but if I change to ZCMD I will have to change all my scripts, I would rather stay with strcmp
Re: I need a warn cmd -
Riddick94 - 10.08.2011
Next time when you will start making Gamemode just hit here on forum to get help with sscanf, zcmd, enum and all options to optimaze your script. Just.. all what you wan't.
Re: I need a warn cmd -
dillo1000 - 10.08.2011
If I do
after what you said it messes my commands up....
Re: I need a warn cmd -
MadeMan - 10.08.2011
pawn Код:
if(strcmp(cmd, "/warn", true) == 0)
{
new string[128];
Re: I need a warn cmd -
Jafet_Macario - 10.08.2011
Ye, you right Riddick and MadeMan, sorry for my mistake.
Re: I need a warn cmd -
dillo1000 - 10.08.2011
Whats pWarn?
Fixed
Thanks ALL!
Re: I need a warn cmd -
dillo1000 - 10.08.2011
Ok I did /warn 1 Test and it said
"1 is not an active player"
Re: I need a warn cmd -
Jafet_Macario - 10.08.2011
Uhm, make sure the player who you warn is connected to your server ^^
This works fine for me.
Re: I need a warn cmd -
dillo1000 - 10.08.2011
I used it on my self and it didnt work?
Re: I need a warn cmd -
dillo1000 - 10.08.2011
Ok its weird some random person just used it on me he is not mod or anything
Re: I need a warn cmd -
Jafet_Macario - 10.08.2011
Oh, then remove
pawn Код:
PlayerInfo[playerid][pAdmin]
and put admin enum as you have it in your gamemode
Re: I need a warn cmd -
dillo1000 - 10.08.2011
I changed that to my admin script instead and that was what happened
Re: I need a warn cmd -
Jafet_Macario - 10.08.2011
Post here please you changes
Re: I need a warn cmd -
Riddick94 - 10.08.2011
When i was creating my Gamemode for the first time i used strcmp.. this gamemode has got over 120 command. Then one day i get learnt about DCMD. Now.. think how many time i spent to change this all commands to DCMD?
![Smiley](images/smilies/smile.png)
It was a long time ago.. yea.. i remember this times, ah..
The moral is:
Change your commands to ZCMD and Sscanf.. it will be safer for your server.