10.09.2010, 13:04
So guys, I realized I had to learn dcmd and sscanf to script this shit properly.
Anyway, I followed the instructions on the wiki about dcmd the best I could, here's what I got:
Under my includes(tried under my color defines too):
Under OnPlayerCommandText:
Bottom of script(outside any other function):
Here's the errors I get:
Could someone explain what I did wrong?
Also, I read about sscanf on the wiki as well. But I'm still not sure how to use it. If there is a tutorial somewhere, or someone would like to give me a brief and basic one, I'd be really happy.
Final question: Even with dcmd, the best I can do with commands is 1 parameter. Like /slap (ID). With trouble, I could do something like /spray (color 1) (color2). But how do I make a command with, say, 4 parameters? Like /ajail (ID/name) (time) (cell) (reason)?
Thanks for any help.
Anyway, I followed the instructions on the wiki about dcmd the best I could, here's what I got:
Under my includes(tried under my color defines too):
Код:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Код:
dcmd(kill, 4, cmdtext); dmcd(slap, 4, cmdtext);
Код:
dcmd_kill(playerid, params[]) { DidKill[playerid] = 1; SetPlayerHealth(playerid, 0); SendClientMessage(playerid, COLOR_ORANGE, "You committed suicide."); return 1; } dcmd_slap(playerid, params[]) { new id; if(strlen(params)) { id = strval(params); if(IsPlayerConnected(id)) { if(PlayerInfo[playerid][AdminLevel] > 1) { new Float:px, Float:py, Float:pz; GetPlayerPosition(playerid, px, py, pz); SetPlayerPosition(playerid, px, py, pz+15); SendClientMessage(playerid, } else { SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command."); } } else { SendClientMessage(playerid, COLOR_GREY, "Invalid Player ID."); } } else { SendClientMessage(playerid, COLOR_GREY, "Usage: /slap (playerid)" } return 1; }
Quote:
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\ServerScript\pawno\edited.pwn(1421) : error 017: undefined symbol "dmcd" C:\Program Files (x86)\Rockstar Games\GTA San Andreas\ServerScript\pawno\edited.pwn(2081) : warning 203: symbol is never used: "params" C:\Program Files (x86)\Rockstar Games\GTA San Andreas\ServerScript\pawno\edited.pwn(2120) : warning 203: symbol is never used: "dcmd_slap" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error. |
Also, I read about sscanf on the wiki as well. But I'm still not sure how to use it. If there is a tutorial somewhere, or someone would like to give me a brief and basic one, I'd be really happy.
Final question: Even with dcmd, the best I can do with commands is 1 parameter. Like /slap (ID). With trouble, I could do something like /spray (color 1) (color2). But how do I make a command with, say, 4 parameters? Like /ajail (ID/name) (time) (cell) (reason)?
Thanks for any help.