Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
- // BLACK DONELLY CLASS SELECTION CREATOR VERSÃO STRCMP 18/07/2012
- ////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////
- #include <a_samp>
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" BLACK DONELLY STRCMP CLASS SELECTION CREATOR CARREGADO!");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n--------------------------------------");
- print(" BLACK DONELLY STRCMP CLASS SELECTION CREATOR DESCARREGADO!");
- print("--------------------------------------\n");
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new index, cmd[128];
- cmd = strtok(cmdtext, index);
- if (!strcmp("/scs",cmd,true))
- {
- new tmp[128];
- tmp = strtok(cmdtext, index);
- if(!strlen(tmp) || !IsNumeric(tmp)) return SendClientMessage(playerid,-1,"USO: /scs [disctância entre 2 e 8]");
- static Float:pPos[6],string[160];
- new distancia=strval(tmp);
- GetPlayerPos(playerid,pPos[0],pPos[1],pPos[2]);
- GetPlayerFacingAngle(playerid,pPos[3]);
- GetXYInFrontOfPlayer(playerid, pPos[4], pPos[5], distancia);
- new File:filex = fopen("ClassPosions.txt", io_append);
- fwrite(filex,"//=============================================================== \r\n");
- fwrite(filex,"NA PUBLIC OnPlayerRequestClass COLE ISTO:\r\n");
- fwrite(filex,"//\r\n");
- format(string,sizeof(string),"SetPlayerPos(playerid, %f, %f, %f);\r\n",pPos[0],pPos[1],pPos[2]);
- fwrite(filex,string);
- format(string,sizeof(string),"SetPlayerCameraPos(playerid, %f, %f, %f);\r\n",pPos[4],pPos[5],pPos[2]);
- fwrite(filex,string);
- format(string,sizeof(string),"SetPlayerCameraLookAt(playerid, %f, %f, %f);\r\n",pPos[0],pPos[1],pPos[2]);
- fwrite(filex,string);
- format(string,sizeof(string),"SetPlayerFacingAngle(playerid, %f);\r\n",pPos[3]);
- fwrite(filex,string);
- if(GetPlayerInterior(playerid) != 0)
- {
- format(string,sizeof(string),"SetPlayerInterior(playerid,%d);\r\n",GetPlayerInterior(playerid));
- fwrite(filex,string);
- }
- fclose(filex);
- SendClientMessage(playerid,0x0080C0AA," ");
- SendClientMessage(playerid,0x0080C0AA,"|| Sua seleção de classe foi salva em 'ClassPosions.txt' na pasta scriptfiles ||");
- SendClientMessage(playerid,0x0080C0AA," ");
- return 1;
- }
- return 0;
- }
- GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
- {
- new Float:a;
- GetPlayerPos(playerid, x, y, a);
- GetPlayerFacingAngle(playerid, a);
- if (GetPlayerVehicleID(playerid))
- {
- GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
- }
- x += (distance * floatsin(-a, degrees));
- y += (distance * floatcos(-a, degrees));
- }
- 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;
- }
- //-----
- stock IsNumeric(const string[]) { // by DracoBlue
- new length=strlen(string);
- if (length==0) return false;
- for (new i = 0; i < length; i++) {
- if (
- (string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') // Not a number,'+' or '-'
- || (string[i]=='-' && i!=0) // A '-' but not at first.
- || (string[i]=='+' && i!=0) // A '+' but not at first.
- ) return false;
- }
- if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment