12.05.2010, 05:41
i can't compile the pwn , he don;t work ....
Код:
#include <a_samp> #include <pcash> #define FILTERSCRIPT #if defined FILTERSCRIPT #define red 0xFF0000AA #define green 0x33FF33AA public OnFilterScriptInit() { print("--------------------------------------"); print(" Simple PCash test and example script "); print("--------------------------------------"); return 1; } #endif public OnPlayerConnect(playerid) { ResetPlayerPCash(playerid); return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[256], idx; cmd = strtok(cmdtext, idx); if(strcmp("/GivePCash", cmd, true) == 0) { new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid, red, "You did not give an ID or ammount"); if(strval(tmp) == playerid) return SendClientMessage(playerid, red, "You can not give yourself PCash"); if(IsPlayerConnected(strval(tmp)) == 0) return SendClientMessage(playerid, red, "That player is not connected"); new tmp2[256]; tmp2 = strtok(cmdtext, idx); if(!strlen(tmp2)) return SendClientMessage(playerid, red, "You did not give an ammount"); new player = strval(tmp); new ammount = strval(tmp2); if(GetPlayerPCash(playerid) < ammount) return SendClientMessage(playerid, red, "You do not have enough PCash"); new pname[MAX_PLAYER_NAME]; GetPlayerName(player, pname, sizeof(pname)); new oname[MAX_PLAYER_NAME]; GetPlayerName(playerid, oname, sizeof(oname)); new string[256]; format(string, sizeof(string), "You have given %s %d PCash", pname, ammount); SendClientMessage(playerid, green, string); format(string, sizeof(string), "You have been given %d PCash by %s", ammount, oname); SendClientMessage(player, green, string); GivePlayerPCash(player, ammount); GivePlayerPCash(playerid, -ammount); return 1; } if(strcmp("/ConvertPCash", cmd, true) == 0) { new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid, red, "You did not give an ammount"); new ammount = strval(tmp); if(GetPlayerPCash(playerid) < ammount) return SendClientMessage(playerid, red, "You do not have enough PCash"); new string[256]; format(string, sizeof(string), "You have converted %d PCash", ammount); SendClientMessage(playerid, green, string); GivePlayerPCash(playerid, -ammount); GivePlayerMoney(playerid, ammount); return 1; } if (strcmp("/MyPCash", cmdtext, true) == 0) { new string[256]; format(string, sizeof(string), "PCash: %d", GetPlayerPCash(playerid)); SendClientMessage(playerid, green, string); return 1; } if(strcmp("/GiveMePCash", cmdtext, true) == 0) { if(IsPlayerAdmin(playerid) == 0) return SendClientMessage(playerid, red, "You are not an admin"); GivePlayerPCash(playerid, 1000); SendClientMessage(playerid, green, "You got 1000 PCash"); return 1; } return 0; } strtok(const string[], &index) { new length = strlen(string); while ((index < length) && (string[index] <= ' ')) { index++; } new offset = index; new result[20]; while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; return result; }