Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=================================ATTEMPTING SYSTEM BY MELEK MIZHER===============================//
- #include <a_samp>
- // UNDER ONPLAYERCOMMANDTEXT
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(strcmp(cmd, "/attempt", true) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- if(gPlayerLogged[playerid] == 0)
- {
- SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet !");
- return 1;
- }
- GetPlayerName(playerid, sendername, sizeof(sendername));
- new length = strlen(cmdtext);
- while ((idx < length) && (cmdtext[idx] <= ' '))
- {
- idx++;
- }
- new offset = idx;
- new result[96];
- while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
- {
- result[idx - offset] = cmdtext[idx];
- idx++;
- }
- result[idx - offset] = EOS;
- if(!strlen(result))
- {
- SendClientMessage(playerid, COLOR_WHITE, "Usage: /attempt [Action]");
- return 1;
- }
- new attempt = random(2);
- if(attempt == 1)
- {
- if(PlayerInfo[playerid][pMask] == 1)
- {
- format(string, sizeof(string), "* The Stranger has attempted to %s and succeeded.", result);
- }
- else
- {
- format(string, sizeof(string), "* %s has attempted to %s and succeeded.", sendername, result);
- }
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- else
- {
- if(PlayerInfo[playerid][pMask] == 1)
- {
- format(string, sizeof(string), "* The Stranger has attempted to %s and failed.", result);
- }
- else
- {
- format(string, sizeof(string), "* %s has attempted to %s and failed.", sendername, result);
- }
- ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
- }
- }
- return 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement