12.07.2010, 03:36
I'm having and Issue Transitioning these 3 commands From cmdtext to dcmd. cmd's works fine but example when I type example /write 3(id) hello (text) , it doesn't show part of the message or is a different color. whats my problem here? I figure its strmid what do you think the problem is?
CODE:
CODE:
Код:
dcmd_pm(playerid,params[]){ new dir[256],tmp[256], Index; dir = strtok(params, Index); strmid(tmp, params, 0, strlen(params)); if(!strlen(dir) || strlen(dir) > 5) { SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (your id) (message)"); return 1; } dir = strtok(params, Index); new id = strval(tmp); gMessage = strrest(params,Index); if(!strlen(gMessage)) { SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (your id) (message)"); return 1; } if(!IsPlayerConnected(id)) { SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/pm : Bad player ID"); return 1; } if(playerid != id) { GetPlayerName(id,iName,sizeof(iName)); GetPlayerName(playerid,pName1,sizeof(pName1)); format(Message,sizeof(Message),">> %s(%d): %s",iName,id,gMessage); SendClientMessage(playerid,PM_OUTGOING_COLOR,Message); format(Message,sizeof(Message),"** %s(%d): %s",pName1,playerid,gMessage); SendClientMessage(id,PM_INCOMING_COLOR,Message); PlayerPlaySound(id,1085,0.0,0.0,0.0); printf("PM: %s",Message); } else { SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"You cannot PM yourself"); } return 1; } dcmd_spam(playerid,params[]) { if(PlayerInfo[playerid][Level] >= 3) { new dir[256],tmp[256], Index,string[128]; dir = strtok(params, Index); strmid(tmp, params, 0, strlen(params)); if(!strlen(dir)) { SendClientMessage(playerid, 0xFFFF00FF, "USAGE: /spam [Colour] [Text]"); SendClientMessage(playerid, 0xFFFF00FF, "Colours: 0=Black 1= 2=0xFFFF00FF 3=0xFFFF00FF 4=0xFFFF00FF 5=0xFFFF00FF 6=0xFFFF00FF 7=purple 8=brown 9=pink"); return 1; } dir = strtok(params, Index); new Colour = strval(tmp); if(Colour > 9 ) return SendClientMessage(playerid, 0xFFFF00FF, "Colours: 0=0xFFFF00FF 1=0xFFFF00FF 2=0xFFFF00FF 3=0xFFFF00FF 4=0xFFFF00FF 5=0xFFFF00FF 6=0xFFFF00FF 7=purple 8=brown 9=pink"); format(string, sizeof(string), "%s", tmp); if(Colour == 0) for(new i; i < 50; i++) SendClientMessageToAll(0x40404050,string); else if(Colour == 1) for(new i; i < 50; i++) SendClientMessageToAll(0xFFFFFF50,string); else if(Colour == 2) for(new i; i < 50; i++) SendClientMessageToAll(0xFF000050,string); else if(Colour == 3) for(new i; i < 50; i++) SendClientMessageToAll(0xFF800050,string); else if(Colour == 4) for(new i; i < 50; i++) SendClientMessageToAll(0xFFFF0050,string); else if(Colour == 5) for(new i; i < 50; i++) SendClientMessageToAll(0x00FF0050,string); else if(Colour == 6) for(new i; i < 50; i++) SendClientMessageToAll(0x0040FF50,string); else if(Colour == 7) for(new i; i < 50; i++) SendClientMessageToAll(0xFF00FF50,string); else if(Colour == 8) for(new i; i < 50; i++) SendClientMessageToAll(0x994D0050,string); else if(Colour == 9) for(new i; i < 50; i++) SendClientMessageToAll(0xFF80FF50,string); return 1; } else return SendClientMessage(playerid,0xFFFF00FF,"ERROR: You need to be level 3 to use this command"); } dcmd_write(playerid,params[]) { if(PlayerInfo[playerid][Level] >= 1) { new dir[256],tmp[256], Index,string[128]; dir = strtok(params, Index); strmid(tmp, params, 0, strlen(params)); if(!strlen(dir)) { SendClientMessage(playerid, 0xFFFF00FF, "USAGE: /write [Colour] [Text]"); return SendClientMessage(playerid, 0xFFFF00FF, "Colours: 0=Black 1=White 2=Red 3=Orange 4=Yellow 5=Green 6=Blue 7=Purple 8=Brown 9=Pink"); } dir = strtok(params, Index); new Colour; Colour = strval(tmp); if(Colour > 9 ) { SendClientMessage(playerid, 0xFFFF00FF, "USAGE: /write [Colour] [Text]"); return SendClientMessage(playerid, 0xFFFF00FF, "Colours: 0=Black 1=White 2=Red 3=Orange 4=Yellow 5=Green 6=Blue 7=Purple 8=Brown 9=Pink"); } dir = strtok(params, Index); CMDMessageToAdmins(playerid,"WRITE"); if(Colour == 0) { format(string,sizeof(string),"%s",tmp); SendClientMessageToAll(0x40404050,string); return 1; } else if(Colour == 1) { format(string,sizeof(string),"%s",tmp); SendClientMessageToAll(0xFFFFFF50,string); return 1; } else if(Colour == 2) { format(string,sizeof(string),"%s",tmp); SendClientMessageToAll(0xFF000050,string); return 1; } else if(Colour == 3) { format(string,sizeof(string),"%s",tmp); SendClientMessageToAll(0xFF800050,string); return 1; } else if(Colour == 4) { format(string,sizeof(string),"%s",tmp); SendClientMessageToAll(0xFFFF0050,string); return 1; } else if(Colour == 5) { format(string,sizeof(string),"%s",tmp); SendClientMessageToAll(0x00FF0050,string); return 1; } else if(Colour == 6) { format(string,sizeof(string),"%s",tmp); SendClientMessageToAll(0x0040FF50,string); return 1; } else if(Colour == 7) { format(string,sizeof(string),"%s",tmp); SendClientMessageToAll(0xFF00FF50,string); return 1; } else if(Colour == 8) { format(string,sizeof(string),"%s",tmp); SendClientMessageToAll(0x994D0050,string); return 1; } else if(Colour == 9) { format(string,sizeof(string),"%s",tmp); SendClientMessageToAll(0xFF80FF50,string); return 1; } return 1; } else return SendClientMessage(playerid,0xFFFF00FF,"ERROR: You need to be level 1 to use this command"); }