02.07.2009, 22:48
I need the /b code for the OOC talk like
/b <ooc talk>
/b <ooc talk>
Originally Posted by yezizhu
public OnPlayerCommandText(playerid,cmdtext[]){
if(!strcmp("/b ",cmdtext,false,3)){ if(cmdtext[3]){ OnPlayerText(playerid,cmdtext[3]); }else SendClientMessage(playerid,COLOR_YOUWANT,"Usage:/b [text]"); } return true; } return false; } |
public OnPlayerCommandText(playerid,cmdtext[]){ if(!strcmp("/b ",cmdtext,false,3)){ if(cmdtext[3]){ OnPlayerText(playerid,cmdtext[3]); }else SendClientMessage(playerid,COLOR_YOUWANT,"Usage:/b [text]"); } return true; } return false; }
public OnPlayerCommandText(playerid, cmdtext[]) { new string[256]; new cmd[256]; new idx; cmd = strtok(cmdtext, idx); new tmp[256]; new giveplayerid; if(gPlayerLogged[playerid] == 1) { //==================================================[ADMINISTRATOR COMMANDS]================================================= if(strcmp(cmd, "/gmx", true) == 0) { if(IsPlayerConnected(playerid)) { if (PlayerInfo[playerid][pAdmin] >= 20) { GameModeRestart(); } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Your not an administrator!"); } } return 1; } if(strcmp(cmd, "/asetleader", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /asetleader [playerid/PartOfName] [FactionID]"); return 1; } new para1; new level; para1 = ReturnUser(tmp); tmp = strtok(cmdtext, idx); level = strval(tmp); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /asetleader [playerid/PartOfName] [FactionID]"); return 1; } if (PlayerInfo[playerid][pAdmin] >= 20) { if(IsPlayerConnected(para1)) { if(para1 != INVALID_PLAYER_ID) { PlayerInfo[para1][pFaction] = level; PlayerInfo[para1][pRank] = 1; SetPlayerSpawn(para1); format(string, sizeof(string), "[INFO:] You have made %s leader of faction ID: %d (%s).", GetPlayerNameEx(para1),level,DynamicFactions[level][fName]); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); format(string, sizeof(string), "[INFO:] You have been made leader of %s by %s.", DynamicFactions[level][fName],GetPlayerNameEx(playerid)); SendClientMessage(para1, COLOR_LIGHTBLUE, string); if(DynamicFactions[level][fUseSkins] == 1) { SetPlayerSkin(para1,DynamicFactions[level][fSkin1]); } } }//not connected } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Your not an administrator or you do not have the required level."); } } return 1; } if(strcmp(cmd, "/advertise", true) == 0 || strcmp(cmd, "/ad", true) == 0) { if(IsPlayerConnected(playerid)) { if(gPlayerLogged[playerid] == 0) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Your not logged in!"); return 1; } new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[128]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] (/ad)vertise [advert text]"); return 1; } for(new i = 0; i < sizeof(Businesses); i++) { if (PlayerToPoint(1.0, playerid,Businesses[i][EnterX], Businesses[i][EnterY], Businesses[i][EnterZ]) || PlayerToPoint(25.0, playerid,Businesses[i][ExitX], Businesses[i][ExitY], Businesses[i][ExitZ])) { if(GetPlayerVirtualWorld(playerid) == i) { if(Businesses[i][BizType] == 5) { if(Businesses[i][Products] != 0) { if ((!adds) && (PlayerInfo[playerid][pAdmin] < 1)) { format(string, sizeof(string), "[ERROR:] You must wait %d seconds before making another advertisement.", (addtimer/1000)); SendClientMessage(playerid, COLOR_LIGHTYELLOW2, string); return 1; } new payout = idx * 25; if(GetPlayerCash(playerid) < payout) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You don't have enough money."); return 1; } GivePlayerCash(playerid, - payout); Businesses[i][Till] += payout; Businesses[i][Products] --; format(string, sizeof(string), "---------------------------------[Advertisement (%s)]---------------------------------", Businesses[i][BusinessName]); SendClientMessageToAll(COLOR_LIGHTGREEN,string); format(string, sizeof(string), "[AD:] %s", result); SendClientMessageToAll(COLOR_WHITE,string); format(string, sizeof(string), "[AD:] Advertisement By: %s - Phone Number: %d.", GetPlayerNameEx(playerid),PlayerInfo[playerid][pPhoneNumber],Businesses[i][BusinessName]); SendClientMessageToAll(COLOR_WHITE,string); SendClientMessageToAll(COLOR_LIGHTGREEN,"-----------------------------------------------------------------------------------------------------------------------"); if (PlayerInfo[playerid][pAdmin] < 1){SetTimer("AddsOn", addtimer, 0);adds = 0;} format(string, sizeof(string), "[INFO:] Characters Contained: %d - Cost: $%d - Thanks from %s", idx,payout,Businesses[i][BusinessName]); SendClientMessage(playerid,COLOR_WHITE,string); PlayerActionMessage(playerid,15.0,"gives the company worker some money and gets his advertisement posted in return."); SaveBusinesses(); return 1; } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] The business is out of products."); } } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] This business is not an advertising company."); } } } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You are not at/in a business."); } } } return 1; } //====================================================[DYNAMIC BUSINESS SYSTEM]============================================== if(strcmp(cmd, "/agotobusiness", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /agotobusiness [id]"); return 1; } new id = strval(tmp); if (PlayerInfo[playerid][pAdmin] >= 1) { SetPlayerPos(playerid,Businesses[id][EnterX],Businesses[id][EnterY],Businesses[id][EnterZ]); SetPlayerInterior(playerid,Businesses[id][EnterInterior]); SetPlayerVirtualWorld(playerid,Businesses[id][EnterWorld]); new form[128]; format(form, sizeof(form), "[INFO:] You teleported to business ID: %d.", id); SendClientMessage(playerid, COLOR_ADMINCMD, form); } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Your not an administrator."); } } return 1; } if(strcmp(cmd, "/abusinessproducts", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /abusinessproducts [businessid] [amount]"); return 1; } if (PlayerInfo[playerid][pAdmin] >= 7) { new id; id = strval(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /abusinessproducts [businessid] [amount]"); return 1; } new id2; id2 = strval(tmp); Businesses[id][Products] = id2; new form[128]; format(form, sizeof form, "You've set Businesses ID: %d's products to %d.", id,id2); SendClientMessage(playerid, COLOR_ADMINCMD,form); SaveBusinesses(); } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Your not an administrator."); } } return 1; } if(strcmp(cmd, "/abusinessprice", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /abusinessprice [businessid] [price]"); return 1; } if (PlayerInfo[playerid][pAdmin] >= 7) { new id; id = strval(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /abusinessprice [businessid] [price]"); return 1; } new id2; id2 = strval(tmp); Businesses[id][BizPrice] = id2; new form[128]; format(form, sizeof form, "You've set Businesses ID: %d's price to %d.", id,id2); SendClientMessage(playerid, COLOR_ADMINCMD,form); SaveBusinesses(); } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Your not an administrator."); } } return 1; } if(strcmp(cmd, "/abusinesstype", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[BUSINESS TYPES:]"); SendClientMessage(playerid, COLOR_ADMINCMD,BUSINESS_TYPES); SendClientMessage(playerid, COLOR_ADMINCMD,BUSINESS_TYPES2); SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /abusinesstype [businessid] [type]"); return 1; } if (PlayerInfo[playerid][pAdmin] >= 7) { new id; new form[128]; id = strval(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2,"[BUSINESS TYPES:]"); SendClientMessage(playerid, COLOR_ADMINCMD,BUSINESS_TYPES); SendClientMessage(playerid, COLOR_ADMINCMD,BUSINESS_TYPES2); SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /abusinesstype [businessid] [type]"); return 1; } new id2; id2 = strval(tmp); Businesses[id][BizType] = id2; format(form, sizeof form, "You've set Businesses ID: %d's type to %d.", id,id2); SendClientMessage(playerid, COLOR_ADMINCMD,form); SaveBusinesses(); } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Your not an administrator."); } } return 1; } if(strcmp(cmd, "/abusinessentrance", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /abusinessentrance [bizid]"); return 1; } new id = strval(tmp); if (PlayerInfo[playerid][pAdmin] >= 7) { new pmodel; new Float:x,Float:y,Float:z; GetPlayerPos(playerid, x, y, z); Businesses[id][EnterX] = x; Businesses[id][EnterY] = y; Businesses[id][EnterZ] = z; Businesses[id][EnterWorld] = GetPlayerVirtualWorld(playerid); Businesses[id][EnterInterior] = GetPlayerInterior(playerid); new Float:angle; GetPlayerFacingAngle(playerid, angle); Businesses[id][EnterAngle] = angle; switch(Businesses[id][Owned]) { case 0: pmodel = 1272; case 1: pmodel = 1239; } ChangeStreamPickupModel(Businesses[id][PickupID],pmodel); MoveStreamPickup(Businesses[id][PickupID],Businesses[id][EnterX], Businesses[id][EnterY], Businesses[id][EnterZ]); SaveBusinesses(); new form[128]; format(form, sizeof(form), "[INFO:] You have set business ID: %d's location.", id); SendClientMessage(playerid, COLOR_ADMINCMD, form); } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Your not an administrator."); } } return 1; } if(strcmp(cmd, "/abusinessexit", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /abusinessexit [bizid]"); return 1; } new id = strval(tmp); if (PlayerInfo[playerid][pAdmin] >= 7) { new Float:x,Float:y,Float:z; GetPlayerPos(playerid, x, y, z); Businesses[id][ExitX] = x; Businesses[id][ExitY] = y; Businesses[id][ExitZ] = z; Businesses[id][ExitInterior] = GetPlayerInterior(playerid); new Float:angle; GetPlayerFacingAngle(playerid, angle); Businesses[id][ExitAngle] = angle; SaveBusinesses(); new form[128]; format(form, sizeof(form), "[INFO:] You have set business ID: %d's exit location.", id); SendClientMessage(playerid, COLOR_ADMINCMD, form); } else { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Your not an administrator."); } } return 1; }
Originally Posted by clean180ollie
Its not working, Pawno says Pawn Compiler has stopped working
|
public OnPlayerCommandText(playerid,cmdtext[]){ if(!strcmp("/b ",cmdtext,false,3)){ if(cmdtext[3]){ OnPlayerText(playerid,cmdtext[3]); }else SendClientMessage(playerid,COLOR_YOUWANT,"Usage:/b [text]"); return true; } return false; }