26.09.2014, 11:38
![Confused](images/smilies/confused.png)
![Confused](images/smilies/confused.png)
![Shocked](images/smilies/surprised.gif)
CMD:ask(playerid,params[])
{
new string[128],playername[24];
if(sscanf(params,"s[128]",params)) return SendClientMessage(playerid,0xFFFFFFFF,"USAGE: /ask [question]");
GetPlayerName(playerid,playername,24);
format(string,sizeof(string),"%s has requested help, question: %s",playername,params);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerAdmin(i)) // Or use your admin variable, e.g. if(PlayerInfo[playerid][pAdmin])
{
SendClientMessage(i,0x00FF00FF,string);
}
}
}
return 1;
}
CMD:reply(playerid,params[])
{
new string[128],playername[24],playerb;
if(!IsPlayerAdmin(playerid)) return 0; //hides the command if they're not an admin
if(sscanf(params,"us[128]",playerb,params)) return SendClientMessage(playerid,0xFFFFFFFF,"USAGE: /reply [id] [response]");
if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid,0xFF0000FF,"Invalid player ID!");
GetPlayerName(playerid,playername,24);
format(string,sizeof(string),"%s has responded, response: %s",playername,params);
SendClientMessage(playerb,0x00FF00FF,string);
GetPlayerName(playerb,playername,24);
format(string,sizeof(string),"You have replied to %s successfully",playername);
SendClientMessage(playerid,0x0000FFFF,string);
return 1;
}
CMD:pay(playerid, params[]) { if(AdminDuty[playerid] == 1) { SendClientMessage(playerid,COLOR_WHITE, "You can't use this command while on-duty as admin."); return 1; } new iTargetID, iCashAmount; if(sscanf(params, "ui", iTargetID, iCashAmount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /pay [playerid/partofname] [amount]"); if(iTargetID == playerid) { SendClientMessage(playerid, COLOR_GRAD1, "You can't use this command on yourself!"); return 1; } if(iCashAmount > 100 && PlayerInfo[playerid][pLevel] < 2) { SendClientMessage(playerid, COLOR_GRAD1, "You must be level 2 to pay over $100"); return 1; } if(iCashAmount < 1 || iCashAmount > 10000) { SendClientMessage(playerid, COLOR_GRAD1, "Don't go below $1, or above $10,000 at once."); return 1; } if(IsPlayerConnected(iTargetID)) { if(ProxDetectorS(5.0, playerid, iTargetID)) { new szMessage[128], giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], playermoney = GetPlayerCash(playerid); giveplayer = GetPlayerNameEx(iTargetID); sendername = GetPlayerNameEx(playerid); if(iCashAmount > 0 && playermoney >= iCashAmount) { GivePlayerCash(playerid, (0 - iCashAmount)); GivePlayerCash(iTargetID, iCashAmount); format(szMessage, sizeof(szMessage), " You have sent %s(player: %d), $%d.", GetPlayerNameEx(iTargetID),iTargetID, iCashAmount); PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); SendClientMessage(playerid, COLOR_GRAD1, szMessage); format(szMessage, sizeof(szMessage), " You have recieved $%d from %s(player: %d).", iCashAmount, GetPlayerNameEx(playerid), playerid); SendClientMessage(iTargetID, COLOR_GRAD1, szMessage); new ip[32], ipex[32]; GetPlayerIp(playerid, ip, sizeof(ip)); GetPlayerIp(iTargetID, ipex, sizeof(ipex)); format(szMessage, sizeof(szMessage), "%s (IP:%s) has paid $%d to %s (IP:%s)", GetPlayerNameEx(playerid), ip, iCashAmount, GetPlayerNameEx(iTargetID), ipex); Log("logs/pay.log", szMessage); PayWarn[playerid][iTargetID] += iCashAmount; if(PayWarn[playerid][iTargetID] >= 10000 && PlayerInfo[playerid][pLevel] <= 3) { format(szMessage, sizeof(szMessage), "%s (IP:%s) has paid %s (IP:%s) $%d in this session.", GetPlayerNameEx(playerid), ip, GetPlayerNameEx(iTargetID), ipex, PayWarn[playerid][iTargetID]); ABroadCast(COLOR_YELLOW, szMessage, 1); } if(iCashAmount >= 100000) { ABroadCast(COLOR_YELLOW,szMessage,1); } PlayerPlaySound(iTargetID, 1052, 0.0, 0.0, 0.0); format(szMessage, sizeof(szMessage), "* %s takes out some cash, and hands it to %s.", GetPlayerNameEx(playerid) ,GetPlayerNameEx(iTargetID)); ProxDetector(30.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); } else { SendClientMessage(playerid, COLOR_GRAD1, " Invalid transaction amount."); } } else { SendClientMessage(playerid, COLOR_GREY, "That player isn't near you."); } } else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified."); return 1; }
/buy command is for when you go into a 24/7 shop and type /buy, then a menu comes up and you can buy stuff like; rope, burger, cellphone, bat... I got the ask and reply command done and it works,thanks so much! One thing though please help with /pay command. The below errors come up when I compile with /pay command in my script:
C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(182) : error 017: undefined symbol "dcmd" C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(185) : warning 225: unreachable code C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(185) : error 017: undefined symbol "dcmd_pay" C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(18 ![]() C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(18 ![]() C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(189) : error 017: undefined symbol "COLOR_GREEN" C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(190) : error 017: undefined symbol "COLOR_GREEN" C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(194) : error 017: undefined symbol "COLOR_LIGHTBLUE" C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(196) : error 017: undefined symbol "COLOR_LIGHTBLUE" C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(199) : warning 217: loose indentation C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(224) : warning 217: loose indentation C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(232) : warning 225: unreachable code C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(232) : warning 217: loose indentation C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(232) : error 029: invalid expression, assumed zero C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(232) : error 004: function "S@@_OnPlayerEnterVehicle" is not implemented C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(237) : warning 225: unreachable code C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(237) : error 029: invalid expression, assumed zero C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(237) : error 004: function "S@@_OnPlayerExitVehicle" is not implemented C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(242) : warning 225: unreachable code C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(242) : error 029: invalid expression, assumed zero C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(242) : error 004: function "S@@_OnPlayerStateChange" is not implemented C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(247) : warning 225: unreachable code C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(247) : error 029: invalid expression, assumed zero C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(247) : error 004: function "S@@_OnPlayerEnterCheckpoint" is not implemented C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(252) : warning 225: unreachable code C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(252) : error 029: invalid expression, assumed zero C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(252) : error 004: function "S@@_OnPlayerLeaveCheckpoint" is not implemented C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(257) : warning 225: unreachable code C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(257) : error 029: invalid expression, assumed zero C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(257) : error 004: function "S@@_OnPlayerEnterRaceCheckpoint" is not implemented C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(262) : warning 225: unreachable code C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(262) : error 029: invalid expression, assumed zero C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(262) : error 004: function "S@@_OnPlayerLeaveRaceCheckpoint" is not implemented C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(267) : warning 225: unreachable code C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(267) : error 029: invalid expression, assumed zero C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(267) : error 004: function "S@@_OnRconCommand" is not implemented C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(272) : warning 225: unreachable code C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(272) : error 029: invalid expression, assumed zero C:\Documents and Settings\MY USERNAME\Desktop\mss\gamemodes\ssfr.pwn(272) : error 004: function "S@@_OnPlayerRequestSpawn" is not implemented I attached a picture with the pawno code. * Also don't worry about the color errors I know hot to fix them! I scripted this command from this tutoriual: https://sampforum.blast.hk/showthread.php?tid=239547 ![]() ![]() |
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(pay, 3, cmdtext); // this is the format that you will need to use. number 3 is for the characters of the word pay, "p" "a" "y"
return 1;
}
dcmd_pay(playerid, params[])
{
new targetid, value;
if(sscanf(params, "ui", targetid, value)) return SendClientMessage(playerid, COLOR_RED, "ERROR: /pay [playerid] [amount]");
else if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREEN, "Player Not Found");
else if(value > GetPlayerMoney(playerid)) return SendClientMessage(playerid, COLOR_GREEN, "You can't afford that much");
else
{
GivePlayerMoney(targetid, value);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You received %i from %u");
GivePlayerMoney(playerid, 0- value);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You transfered %i to %u");
}
return 1;
}
Blah...