Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include < a_samp >
- #include < zcmd >
- #include < DOF2 >
- #define MAX_OBJ 50
- enum dDrogasEnum
- {
- OID,
- Text3D:TID,
- DDATA[2],
- Float:OPOS[3]
- };
- enum pDrogasEnum
- {
- pMaconha,
- pCocaina,
- pCrack
- }
- new pInfoDrogas[MAX_PLAYERS][pDrogasEnum];
- new iDrogaData[MAX_OBJ][dDrogasEnum];
- public OnFilterScriptInit()
- {
- CarregarDDrogas();
- return 1;
- }
- public OnFilterScriptExit()
- {
- DOF2_Exit();
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- CarregarDrogas(playerid);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- if(!DOF2_FileExists(NomeDoArquivo(playerid))) DOF2_CreateFile(NomeDoArquivo(playerid));
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- SalvarDrogas(playerid);
- return 1;
- }
- CMD:drogas(playerid)
- {
- SendClientMessage(playerid, -1," </minhasdrogas/usardrogas/dardrogas/deixardrogas/pegardrogas/> ");
- return 1;
- }
- CMD:minhasdrogas(playerid)
- {
- new _String[128];
- SendClientMessage(playerid, 0x33AA3300, "____Minhas Drogas____");
- format(_String, sizeof(_String), "Drogas Maconha [%d]", pInfoDrogas[playerid][pMaconha]);
- SendClientMessage(playerid, 0x33AA3300, _String);
- format(_String, sizeof(_String), "Drogas Cocaina [%d]", pInfoDrogas[playerid][pCocaina]);
- SendClientMessage(playerid, 0x33AA3300, _String);
- format(_String, sizeof(_String), "Drogas Crack [%d]", pInfoDrogas[playerid][pCrack]);
- SendClientMessage(playerid, 0x33AA3300, _String);
- return true;
- }
- CMD:obterdrogas(playerid)
- {
- if(IsPlayerAdmin(playerid))
- {
- pInfoDrogas[playerid][pMaconha] = 100;
- pInfoDrogas[playerid][pCocaina] = 100;
- pInfoDrogas[playerid][pCrack] = 100;
- }
- return 1;
- }
- CMD:usardrogas(playerid, params [])
- {
- new tipo;
- if(sscanf(params, "d", tipo)) return SendClientMessage(playerid, -1, "<tipo>/<1 = Cocaina, 2 = Crack, 3 = Maconha>");
- if(tipo == 1)
- {
- RemovePlayerCocaina(playerid, 3);
- SetPlayerDrunkLevel(playerid, 2005);
- SetPlayerWeather(playerid, -22);
- SetTimerEx("DrogasPararEfeito",420000,false,"d",playerid);
- ApplyAnimation(playerid, "MISC", "plyr_shkhead", 4.1, 0, 0, 0, 0, 0);
- SendClientMessage(playerid, -1, "Você usou 3 gramas de cocaina.");
- }
- if(tipo == 2)
- {
- RemovePlayerCrack(playerid, 3);
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
- SetPlayerDrunkLevel(playerid, 2005);
- SetPlayerWeather(playerid, -22);
- SetTimerEx("DrogasPararEfeito",420000,false,"d",playerid);
- SendClientMessage(playerid, -1, "Você usou 3 gramas de crack.");
- }
- if(tipo == 3)
- {
- RemovePlayerMaconha(playerid, 3);
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
- SetPlayerWeather(playerid, -22);
- SetTimerEx("DrogasPararEfeito",420000,false,"d",playerid);
- SendClientMessage(playerid, -1, "Você usou 3 gramas de maconha.");
- }
- return 1;
- }
- CMD:dardrogas(playerid, params [])
- {
- new id, tipo, quant;
- if(sscanf(params, "idd", id, tipo, quant)) return SendClientMessage(playerid, -1, "<id/tipo/quantidade>/<1 = cocaina, 2 = Crack, 3 = Maconha>");
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Jogador não conectado.");
- if(tipo == 1)
- {
- if(pInfoDrogas[playerid][pCocaina] > 0)
- {
- if(pInfoDrogas[playerid][pCocaina] > quant)
- {
- new _String[128];
- new idname[MAX_PLAYER_NAME];
- new playeridname[MAX_PLAYER_NAME];
- GetPlayerName(id, idname, sizeof(idname));
- GetPlayerName(playerid, playeridname, sizeof(playeridname));
- RemovePlayerCocaina(playerid, quant);
- GivePlayerCocaina(id, quant);
- format(_String, sizeof(_String), "Voce entregou drogas para %s.", idname);
- SendClientMessage(playerid, 0x33AA3300, _String);
- format(_String, sizeof(_String), "Voce recebeu drogas de %s.", playeridname);
- SendClientMessage(id, 0x33AA3300, _String);
- }
- else
- {
- SendClientMessage(playerid, -1, "A quantidade que você possue é menor.");
- }
- }
- else
- {
- SendClientMessage(playerid, -1, "Você não tem Cocaina.");
- }
- }
- else if(tipo == 2)
- {
- if(pInfoDrogas[playerid][pCrack] > 0)
- {
- if(pInfoDrogas[playerid][pCrack] > quant)
- {
- new _String[128];
- new idname[MAX_PLAYER_NAME];
- new playeridname[MAX_PLAYER_NAME];
- GetPlayerName(id, idname, sizeof(idname));
- GetPlayerName(playerid, playeridname, sizeof(playeridname));
- RemovePlayerCrack(playerid, quant);
- GivePlayerCrack(id, quant);
- format(_String, sizeof(_String), "Voce entregou drogas para %s.", idname);
- SendClientMessage(playerid, 0x33AA3300, _String);
- format(_String, sizeof(_String), "Voce recebeu drogas de %s.", playeridname);
- SendClientMessage(id, 0x33AA3300, _String);
- }
- else
- {
- SendClientMessage(playerid, -1, "A quantidade que você possue é menor.");
- }
- }
- else
- {
- SendClientMessage(playerid, -1, "Você não tem Crack.");
- }
- }
- else if(tipo == 3)
- {
- if(pInfoDrogas[playerid][pMaconha] > 0)
- {
- if(pInfoDrogas[playerid][pMaconha] > quant)
- {
- new _String[128];
- new idname[MAX_PLAYER_NAME];
- new playeridname[MAX_PLAYER_NAME];
- GetPlayerName(id, idname, sizeof(idname));
- GetPlayerName(playerid, playeridname, sizeof(playeridname));
- RemovePlayerMaconha(playerid, quant);
- GivePlayerMaconha(id, quant);
- format(_String, sizeof(_String), "Voce entregou drogas para %s.", idname);
- SendClientMessage(playerid, 0x33AA3300, _String);
- format(_String, sizeof(_String), "Voce recebeu drogas de %s.", playeridname);
- SendClientMessage(id, 0x33AA3300, _String);
- }
- else
- {
- SendClientMessage(playerid, -1, "A quantidade que você possue é menor.");
- }
- }
- else
- {
- SendClientMessage(playerid, -1, "Você não tem Maconha.");
- }
- }
- return 1;
- }
- CMD:deixardrogas(playerid, params [])
- {
- new _String[128];
- new tipo, quant;
- new f = MAX_OBJ+1;
- if(sscanf(params, "dd", tipo, quant)) return SendClientMessage(playerid, -1, "<tipo/quantidade>");
- if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
- for(new a = 0; a < MAX_OBJ; a++)
- {
- if(iDrogaData[a][OPOS][0] == 0.0)
- {
- f = a;
- break;
- }
- }
- if(f > MAX_OBJ) return SendClientMessage(playerid, 0x33AA3300, "O maximo de itens no chao foi atingido, por favor relate a um administrador.");
- if(tipo == 1)
- {
- if(pInfoDrogas[playerid][pCocaina] >= quant)
- {
- GetPlayerPos(playerid, iDrogaData[f][OPOS][0], iDrogaData[f][OPOS][1], iDrogaData[f][OPOS][2]);
- iDrogaData[f][OID] = CreateObject(1580, iDrogaData[f][OPOS][0], iDrogaData[f][OPOS][1], iDrogaData[f][OPOS][2]-1, 0.0, 0.0, 0.0);
- format(_String, sizeof(_String), "<Cocaina>\nQuantidade:\n%d\n</>", quant);
- iDrogaData[f][TID] = Create3DTextLabel(_String, -1, iDrogaData[f][OPOS][0], iDrogaData[f][OPOS][1], iDrogaData[f][OPOS][2], 3.0, 0, 0);
- SendClientMessage(playerid, 0x33AA3300, "Você largou um pacote de cocaina.");
- RemovePlayerCocaina(playerid, quant);
- iDrogaData[f][DDATA][0] = tipo;
- iDrogaData[f][DDATA][1] = quant;
- new Local[100];
- format(Local, sizeof(Local), "Drogas/Drop/%d.txt", f);
- DOF2_CreateFile(Local);
- DOF2_SetFloat(Local, "POS0", iDrogaData[f][OPOS][0]);
- DOF2_SetFloat(Local, "POS1", iDrogaData[f][OPOS][1]);
- DOF2_SetFloat(Local, "POS2", iDrogaData[f][OPOS][2]);
- DOF2_SetInt(Local, "TIPO", iDrogaData[f][DDATA][0]);
- DOF2_SetInt(Local, "QUANT", iDrogaData[f][DDATA][1]);
- DOF2_SaveFile();
- }
- }
- else if(tipo == 2)
- {
- if(pInfoDrogas[playerid][pCrack] >= quant)
- {
- GetPlayerPos(playerid, iDrogaData[f][OPOS][0], iDrogaData[f][OPOS][1], iDrogaData[f][OPOS][2]);
- iDrogaData[f][OID] = CreateObject(1580, iDrogaData[f][OPOS][0], iDrogaData[f][OPOS][1], iDrogaData[f][OPOS][2]-1, 0.0, 0.0, 0.0);
- format(_String, sizeof(_String), "<Crack>\nQuantidade:\n%d\n</>", quant);
- iDrogaData[f][TID] = Create3DTextLabel(_String, -1, iDrogaData[f][OPOS][0], iDrogaData[f][OPOS][1], iDrogaData[f][OPOS][2], 3.0, 0, 0);
- SendClientMessage(playerid, 0x33AA3300, "Você largou um pacote de crack");
- RemovePlayerCrack(playerid, quant);
- iDrogaData[f][DDATA][0] = tipo;
- iDrogaData[f][DDATA][1] = quant;
- new Local[100];
- format(Local, sizeof(Local), "Drogas/Drop/%d.txt", f);
- DOF2_CreateFile(Local);
- DOF2_SetFloat(Local, "POS0", iDrogaData[f][OPOS][0]);
- DOF2_SetFloat(Local, "POS1", iDrogaData[f][OPOS][1]);
- DOF2_SetFloat(Local, "POS2", iDrogaData[f][OPOS][2]);
- DOF2_SetInt(Local, "TIPO", iDrogaData[f][DDATA][0]);
- DOF2_SetInt(Local, "QUANT", iDrogaData[f][DDATA][1]);
- DOF2_SaveFile();
- }
- }
- else if(tipo == 3)
- {
- if(pInfoDrogas[playerid][pMaconha] >= quant)
- {
- GetPlayerPos(playerid, iDrogaData[f][OPOS][0], iDrogaData[f][OPOS][1], iDrogaData[f][OPOS][2]);
- iDrogaData[f][OID] = CreateObject(1580, iDrogaData[f][OPOS][0], iDrogaData[f][OPOS][1], iDrogaData[f][OPOS][2]-1, 0.0, 0.0, 0.0);
- format(_String, sizeof(_String), "<Maconha>\nQuantidade:\n%d\n</>", quant);
- iDrogaData[f][TID] = Create3DTextLabel(_String, -1, iDrogaData[f][OPOS][0], iDrogaData[f][OPOS][1], iDrogaData[f][OPOS][2], 3.0, 0, 0);
- SendClientMessage(playerid, 0x33AA3300, "Você largou um pacote de maconha");
- RemovePlayerMaconha(playerid, quant);
- iDrogaData[f][DDATA][0] = tipo;
- iDrogaData[f][DDATA][1] = quant;
- new Local[100];
- format(Local, sizeof(Local), "Drogas/Drop/%d.txt", f);
- DOF2_CreateFile(Local);
- DOF2_SetFloat(Local, "POS0", iDrogaData[f][OPOS][0]);
- DOF2_SetFloat(Local, "POS1", iDrogaData[f][OPOS][1]);
- DOF2_SetFloat(Local, "POS2", iDrogaData[f][OPOS][2]);
- DOF2_SetInt(Local, "TIPO", iDrogaData[f][DDATA][0]);
- DOF2_SetInt(Local, "QUANT", iDrogaData[f][DDATA][1]);
- DOF2_SaveFile();
- }
- }
- return 1;
- }
- CMD:pegardrogas(playerid)
- {
- new tipo;
- new Local[100];
- new f = MAX_OBJ+1;
- new pegou; pegou = 5;
- if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
- for(new a = 0; a < MAX_OBJ; a++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 1.0, iDrogaData[a][OPOS][0], iDrogaData[a][OPOS][1], iDrogaData[a][OPOS][2]))
- {
- f = a;
- pegou = 10;
- break;
- }
- }
- if(f > MAX_OBJ) return SendClientMessage(playerid, 0x33AA3300, "Você não pode pegar, pois não tem nada no chao.");
- tipo = iDrogaData[f][DDATA][0];
- if(pegou == 10)
- {
- if(tipo == 1)
- {
- pegou = 5;
- DestroyObject(iDrogaData[f][OID]);
- Delete3DTextLabel(iDrogaData[f][TID]);
- GivePlayerCocaina(playerid, iDrogaData[f][DDATA][1]);
- SendClientMessage(playerid, 0x33AA3300, "Você pegou a cocaina que havia no chão.");
- format(Local, sizeof(Local), "Drogas/Drop/%d.txt", f);
- DOF2_RemoveFile(Local);
- f = -1;
- }
- if(tipo == 2)
- {
- pegou = 5;
- DestroyObject(iDrogaData[f][OID]);
- Delete3DTextLabel(iDrogaData[f][TID]);
- GivePlayerCrack(playerid, iDrogaData[f][DDATA][1]);
- SendClientMessage(playerid, 0x33AA3300, "Você pegou o crack que havia no chão.");
- format(Local, sizeof(Local), "Drogas/Drop/%d.txt", f);
- DOF2_RemoveFile(Local);
- f = -1;
- }
- if(tipo == 3)
- {
- pegou = 5;
- DestroyObject(iDrogaData[f][OID]);
- Delete3DTextLabel(iDrogaData[f][TID]);
- GivePlayerMaconha(playerid, iDrogaData[f][DDATA][1]);
- SendClientMessage(playerid, 0x33AA3300, "Você pegou a maconha que havia no chão.");
- format(Local, sizeof(Local), "Drogas/Drop/%d.txt", f);
- DOF2_RemoveFile(Local);
- f = -1;
- }
- }
- return 1;
- }
- forward DrogasPararEfeito(playerid);
- public DrogasPararEfeito(playerid)
- {
- SetPlayerWeather(playerid, 5);
- }
- stock GetPlayerCocaina(playerid)
- {
- new Cocaina;
- Cocaina = pInfoDrogas[playerid][pCocaina];
- return Cocaina;
- }
- stock GetPlayerCrack(playerid)
- {
- new Crack;
- Crack = pInfoDrogas[playerid][pCrack];
- return Crack;
- }
- stock GetPlayerMaconha(playerid)
- {
- new Maconha;
- Maconha = pInfoDrogas[playerid][pMaconha];
- return Maconha;
- }
- stock GivePlayerCocaina(playerid, quantidade)
- {
- pInfoDrogas[playerid][pCocaina] += quantidade;
- return 1;
- }
- stock GivePlayerCrack(playerid, quantidade)
- {
- pInfoDrogas[playerid][pCrack] += quantidade;
- return 1;
- }
- stock GivePlayerMaconha(playerid, quantidade)
- {
- pInfoDrogas[playerid][pMaconha] += quantidade;
- return 1;
- }
- stock RemovePlayerCocaina(playerid, quantidade)
- {
- pInfoDrogas[playerid][pCocaina] -= quantidade;
- return 1;
- }
- stock RemovePlayerCrack(playerid, quantidade)
- {
- pInfoDrogas[playerid][pCrack] -= quantidade;
- return 1;
- }
- stock RemovePlayerMaconha(playerid, quantidade)
- {
- pInfoDrogas[playerid][pMaconha] -= quantidade;
- return 1;
- }
- stock CarregarDrogas(playerid)
- {
- pInfoDrogas[playerid][pCocaina] = DOF2_GetInt(NomeDoArquivo(playerid), "Cocaina");
- pInfoDrogas[playerid][pCrack] = DOF2_GetInt(NomeDoArquivo(playerid), "Crack");
- pInfoDrogas[playerid][pMaconha] = DOF2_GetInt(NomeDoArquivo(playerid), "Maconha");
- return 1;
- }
- stock NomeDoArquivo(playerid)
- {
- new arquivo[40], name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, 32);
- format(arquivo, 40, "Drogas/%s.ini", name);
- return arquivo;
- }
- stock SalvarDrogas(playerid)
- {
- if(!DOF2_FileExists(NomeDoArquivo(playerid))) DOF2_CreateFile(NomeDoArquivo(playerid));
- else
- {
- DOF2_SetInt(NomeDoArquivo(playerid), "Cocaina", pInfoDrogas[playerid][pCocaina]);
- DOF2_SetInt(NomeDoArquivo(playerid), "Crack", pInfoDrogas[playerid][pCrack]);
- DOF2_SetInt(NomeDoArquivo(playerid), "Maconha", pInfoDrogas[playerid][pMaconha]);
- DOF2_SaveFile();
- }
- return 1;
- }
- stock CarregarDDrogas()
- {
- new Local[100];
- new Texto[100];
- for(new f; f < MAX_OBJ; f++)
- {
- format(Local, sizeof(Local), "Drogas/Drop/%d.txt", f);
- if(DOF2_FileExists(Local))
- {
- iDrogaData[f][OPOS][0] = DOF2_GetFloat(Local, "POS0");
- iDrogaData[f][OPOS][1] = DOF2_GetFloat(Local, "POS1");
- iDrogaData[f][OPOS][2] = DOF2_GetFloat(Local, "POS2");
- iDrogaData[f][DDATA][0] = DOF2_GetInt(Local, "TIPO");
- iDrogaData[f][DDATA][1] = DOF2_GetInt(Local, "QUANT");
- if(iDrogaData[f][DDATA][0] == 1)
- {
- iDrogaData[f][OID] = CreateObject(1580, iDrogaData[f][OPOS][0], iDrogaData[f][OPOS][1], iDrogaData[f][OPOS][2]-1, 0.0, 0.0, 0.0);
- format(Texto, sizeof(Texto), "<Crack>\nQuantidade:\n%d\n</>", iDrogaData[f][DDATA][1]);
- iDrogaData[f][TID] = Create3DTextLabel(Texto, -1, iDrogaData[f][OPOS][0], iDrogaData[f][OPOS][1], iDrogaData[f][OPOS][2], 3.0, 0, 0);
- printf("[DROP] Carregado [%d]", f);
- }
- else if(iDrogaData[f][DDATA][0] == 2)
- {
- iDrogaData[f][OID] = CreateObject(1580, iDrogaData[f][OPOS][0], iDrogaData[f][OPOS][1], iDrogaData[f][OPOS][2]-1, 0.0, 0.0, 0.0);
- format(Texto, sizeof(Texto), "<Crack>\nQuantidade:\n%d\n</>", iDrogaData[f][DDATA][1]);
- iDrogaData[f][TID] = Create3DTextLabel(Texto, -1, iDrogaData[f][OPOS][0], iDrogaData[f][OPOS][1], iDrogaData[f][OPOS][2], 3.0, 0, 0);
- printf("[DROP] Carregado [%d]", f);
- }
- else if(iDrogaData[f][DDATA][0] == 3)
- {
- iDrogaData[f][OID] = CreateObject(1580, iDrogaData[f][OPOS][0], iDrogaData[f][OPOS][1], iDrogaData[f][OPOS][2]-1, 0.0, 0.0, 0.0);
- format(Texto, sizeof(Texto), "<Crack>\nQuantidade:\n%d\n</>", iDrogaData[f][DDATA][1]);
- iDrogaData[f][TID] = Create3DTextLabel(Texto, -1, iDrogaData[f][OPOS][0], iDrogaData[f][OPOS][1], iDrogaData[f][OPOS][2], 3.0, 0, 0);
- printf("[DROP] Carregado [%d]", f);
- }
- }
- }
- }
- stock sscanf(string[], format[], {Float,_}:...)
- {
- #if defined isnull
- if (isnull(string))
- #else
- if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
- #endif
- {
- return format[0];
- }
- #pragma tabsize 4
- new
- formatPos = 0,
- stringPos = 0,
- paramPos = 2,
- paramCount = numargs(),
- delim = ' ';
- while (string[stringPos] && string[stringPos] <= ' ')
- {
- stringPos++;
- }
- while (paramPos < paramCount && string[stringPos])
- {
- switch (format[formatPos++])
- {
- case '\0':
- {
- return 0;
- }
- case 'i', 'd':
- {
- new
- neg = 1,
- num = 0,
- ch = string[stringPos];
- if (ch == '-')
- {
- neg = -1;
- ch = string[++stringPos];
- }
- do
- {
- stringPos++;
- if ('0' <= ch <= '9')
- {
- num = (num * 10) + (ch - '0');
- }
- else
- {
- return -1;
- }
- }
- while ((ch = string[stringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num * neg);
- }
- case 'h', 'x':
- {
- new
- num = 0,
- ch = string[stringPos];
- do
- {
- stringPos++;
- switch (ch)
- {
- case 'x', 'X':
- {
- num = 0;
- continue;
- }
- case '0' .. '9':
- {
- num = (num << 4) | (ch - '0');
- }
- case 'a' .. 'f':
- {
- num = (num << 4) | (ch - ('a' - 10));
- }
- case 'A' .. 'F':
- {
- num = (num << 4) | (ch - ('A' - 10));
- }
- default:
- {
- return -1;
- }
- }
- }
- while ((ch = string[stringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num);
- }
- case 'c':
- {
- setarg(paramPos, 0, string[stringPos++]);
- }
- case 'f':
- {
- new changestr[16], changepos = 0, strpos = stringPos;
- while(changepos < 16 && string[strpos] && string[strpos] != delim)
- {
- changestr[changepos++] = string[strpos++];
- }
- changestr[changepos] = '\0';
- setarg(paramPos,0,_:floatstr(changestr));
- }
- case 'p':
- {
- delim = format[formatPos++];
- continue;
- }
- case '\'':
- {
- new
- end = formatPos - 1,
- ch;
- while ((ch = format[++end]) && ch != '\'') {}
- if (!ch)
- {
- return -1;
- }
- format[end] = '\0';
- if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
- {
- if (format[end + 1])
- {
- return -1;
- }
- return 0;
- }
- format[end] = '\'';
- stringPos = ch + (end - formatPos);
- formatPos = end + 1;
- }
- case 'u':
- {
- new
- end = stringPos - 1,
- id = 0,
- bool:num = true,
- ch;
- while ((ch = string[++end]) && ch != delim)
- {
- if (num)
- {
- if ('0' <= ch <= '9')
- {
- id = (id * 10) + (ch - '0');
- }
- else
- {
- num = false;
- }
- }
- }
- if (num && IsPlayerConnected(id))
- {
- setarg(paramPos, 0, id);
- }
- else
- {
- #if !defined foreach
- #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
- #define __SSCANF_FOREACH__
- #endif
- string[end] = '\0';
- num = false;
- new
- name[MAX_PLAYER_NAME];
- id = end - stringPos;
- foreach (Player, playerid)
- {
- GetPlayerName(playerid, name, sizeof (name));
- if (!strcmp(name, string[stringPos], true, id))
- {
- setarg(paramPos, 0, playerid);
- num = true;
- break;
- }
- }
- if (!num)
- {
- setarg(paramPos, 0, INVALID_PLAYER_ID);
- }
- string[end] = ch;
- #if defined __SSCANF_FOREACH__
- #undef foreach
- #undef __SSCANF_FOREACH__
- #endif
- }
- stringPos = end;
- }
- case 's', 'z':
- {
- new
- i = 0,
- ch;
- if (format[formatPos])
- {
- while ((ch = string[stringPos++]) && ch != delim)
- {
- setarg(paramPos, i++, ch);
- }
- if (!i)
- {
- return -1;
- }
- }
- else
- {
- while ((ch = string[stringPos++]))
- {
- setarg(paramPos, i++, ch);
- }
- }
- stringPos--;
- setarg(paramPos, i, '\0');
- }
- default:
- {
- continue;
- }
- }
- while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
- {
- stringPos++;
- }
- while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
- {
- stringPos++;
- }
- paramPos++;
- }
- do
- {
- if ((delim = format[formatPos++]) > ' ')
- {
- if (delim == '\'')
- {
- while ((delim = format[formatPos++]) && delim != '\'') {}
- }
- else if (delim != 'z')
- {
- return delim;
- }
- }
- }
- while (delim > ' ');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement