Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is a comment
- // uncomment the line below if you want to write a filterscript
- //#define FILTERSCRIPT
- #include <a_samp>
- #define COLOR_YELLOW 0xFFFF00AA
- #define SHS_PASS "imtrue1"
- new name[MAX_PLAYER_NAME];
- new SHSLoggedIn[MAX_PLAYERS];
- new CreatedVehs[100];
- public OnFilterScriptInit()
- {
- for(new v = 0; v < sizeof(CreatedVehs); v++)
- {
- CreatedVehs[v] = INVALID_VEHICLE_ID;
- }
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(SHSLoggedIn[playerid] == 1) { SHSLoggedIn[playerid] = 0; SCM(playerid,"Disconnected from SHS,Stuff saved at scriptfiles/logs/shs.txt");}
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[128],idx;
- cmd = strtok(cmdtext, idx);
- if(strcmp(cmd,"/mpos",true) == 0)
- {
- if(SHSLoggedIn[playerid] == 0) return SCM(playerid,"You must log in SHS before using it commands ( /shslogin [pass] ) ");
- new tmp[32];
- tmp = strtok(cmdtext, idx);
- new Float:X,Float:Y,Float:Z,I;
- GetPlayerPos(playerid,X,Y,Z);
- I = GetPlayerInterior(playerid);
- new str[128];
- format(str,sizeof(str),"X [%f] Y [%f] Z [%f] I [%d] saved",X,Y,Z,I);
- SCM(playerid,str);
- if(!strlen(tmp)) { SCM(playerid,"Recommended to add a save name, ( /mypos [name] )"); }
- GetPlayerName(playerid,name,sizeof(name));
- new longstr[256];
- format(longstr,sizeof(longstr),"%s has used /mpos cmd . ( X [%f] Y [%f] Z [%f] I [%d] ) // %s",name,X,Y,Z,I,tmp);
- SystemLog(longstr);
- return 1;
- }
- if(strcmp(cmd,"/ppos",true) == 0)
- {
- if(SHSLoggedIn[playerid] == 0) return SCM(playerid,"You must log in SHS before using it commands ( /shslogin [pass] ) ");
- new tmp[32],tmp2[32];
- tmp2 = strtok(cmdtext,idx);
- tmp = strtok(cmdtext,idx);//Playerid
- if(!strlen(tmp2)) return SCM(playerid,"USAGE: /ppos [targetid/name] [savename(optional)]");
- if(!IsPlayerConnected(strval(tmp2))) return SCM(playerid,"That player is not online !");
- if(!strlen(tmp)) { SCM(playerid,"Recommended to add a save name, ( /ppos [name] )"); }
- new Float:X,Float:Y,Float:Z,I;
- GetPlayerPos(strval(tmp2),X,Y,Z);
- I = GetPlayerInterior(strval(tmp2));
- new longstr[256];
- GetPlayerName(playerid,name,sizeof(name));
- new tname[MAX_PLAYER_NAME];
- GetPlayerName(strval(tmp2),tname,sizeof(tname));
- format(longstr,sizeof(longstr),"X [%f] Y [%f] Z [%f] I [%d] T [%s] saved.",X,Y,Z,I,tmp2,tname);
- SCM(playerid,longstr);
- format(longstr,sizeof(longstr),"%s has used /ppos on %s, X [%f] Y [%f] Z [%f] I [%d] // %s",name,tname,X,Y,Z,I,tmp);
- SystemLog(longstr);
- return 1;
- }
- if(strcmp(cmd,"/cv",true) == 0)
- {
- if(SHSLoggedIn[playerid] == 0) return SCM(playerid,"You must log in SHS before using it commands ( /shslogin [pass] ) ");
- new model[32],c1[32],c2[32];
- model = strtok(cmdtext,idx);
- c1 = strtok(cmdtext,idx);
- c2 = strtok(cmdtext,idx);
- if(!strval(model)) return SCM(playerid,"USAGE: /cv [model] [color1] [color2]");
- if(!strval(c1)) return SCM(playerid,"USAGE: /cv [model] [color1] [color2]");
- if(!strval(c2)) return SCM(playerid,"USAGE: /cv [model] [color1] [color2]");
- for (new iii; iii < sizeof(CreatedVehs); iii++)
- {
- if(CreatedVehs[iii] == INVALID_VEHICLE_ID)
- {
- new Float:X,Float:Y,Float:Z,Float:FA;
- GetPlayerPos(playerid,X,Y,Z);
- GetPlayerFacingAngle(playerid,FA);
- new I = GetPlayerInterior(playerid);
- CreatedVehs[iii] = CreateVehicle(strval(model),X,Y,Z,FA,strval(c1),strval(c2),-1);
- LinkVehicleToInterior(CreatedVehs[iii],I);
- SCM(playerid,"Vehicle created !");
- return 1;//So it wont create 100 vehicles .... and SCM(playerid,"Vehicle created !");
- }
- }
- return 1;
- }
- if(strcmp(cmd,"/dvs",true) == 0)
- {
- if(SHSLoggedIn[playerid] == 0) return SCM(playerid,"You must log in SHS before using it commands ( /shslogin [pass] ) ");
- for(new i = 0; i < sizeof(CreatedVehs); i++)
- {
- if(CreatedVehs[i] != INVALID_VEHICLE_ID)
- {
- DestroyVehicle(CreatedVehs[i]);
- CreatedVehs[i] = INVALID_VEHICLE_ID;
- // no return , we need to loop it , to delete all createdvehs
- }
- }
- SCM(playerid,"Destroyed all created ( /cv ) vehicles");
- return 1;
- }
- if(strcmp(cmd,"/dv",true) == 0)
- {
- if(SHSLoggedIn[playerid] == 0) return SCM(playerid,"You must log in SHS before using it commands ( /shslogin [pass] ) ");
- if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid,"You are not in any vehicle !");
- new bool:bl = false, ind = INVALID_VEHICLE_ID;
- if(IsPlayerInAnyVehicle(playerid))
- {
- for( new i=0; i<sizeof(CreatedVehs); i++)
- {
- if(!bl)
- {
- if(CreatedVehs[i] == GetPlayerVehicleID(playerid)) // Checking for next available ID.
- {
- bl = true;
- ind = i;
- }
- }
- }
- if(ind != INVALID_VEHICLE_ID)
- {
- new carid = GetPlayerVehicleID(playerid);
- DestroyVehicle(carid);
- CreatedVehs[ind] = INVALID_VEHICLE_ID;
- }
- }
- return SCM(playerid,"Vehicle destroyed !");
- }
- if(strcmp(cmd,"/getv",true) == 0)
- {
- if(SHSLoggedIn[playerid] == 0) return SCM(playerid,"You must log in SHS before using it commands ( /shslogin [pass] ) ");
- new vid[32];
- vid = strtok(cmdtext,idx);
- if(!strval(vid)) return SCM(playerid,"USAGE: /getv [vehicleid]");
- new Float:X,Float:Y,Float:Z,I;
- GetPlayerPos(playerid,X,Y,Z);
- I = GetPlayerInterior(playerid);
- SetVehiclePos(strval(vid),X,Y,Z);
- LinkVehicleToInterior(strval(vid),I);
- return 1;
- }
- if(strcmp(cmd,"/shslogin",true) == 0)
- {
- if(SHSLoggedIn[playerid] == 1) return SCM(playerid,"You are already logged into SHS !");
- new tmp[32];
- tmp = strtok(cmdtext,idx);
- if(!strlen(tmp)) return SCM(playerid,"USAGE: /shslogin [pass]");
- if(strcmp(tmp,SHS_PASS,false) == 0)
- {
- SCM(playerid,"Logged in shs . /shshelp to see the cmd's");
- SHSLoggedIn[playerid] = 1;
- return 1;
- }else return SCM(playerid,"Wrong SHS Password!");
- }
- if(strcmp(cmdtext,"/shshelp",true) == 0)
- {
- SendClientMessage(playerid,COLOR_YELLOW,"/ppos [ Find someones pos ] ||| /mpos [ Find your pos ] ||| /shslogin [ Login to SHS ]");
- SendClientMessage(playerid,COLOR_YELLOW,"/getv [ Get vehicle by ID ] ||| /cv [ Create a vehicle ] ||| /dvs [ Destroy all created vehicles ( /cv )");
- return 1;
- }
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- if(SHSLoggedIn[playerid] == 1) { SCM(playerid,"/dl to see vehicle info");}
- return 1;
- }
- forward SCM(playerid,string[]);
- public SCM(playerid,string[])
- {
- SendClientMessage(playerid,COLOR_YELLOW,string);
- return 1;
- }
- forward SystemLog(string[]);
- public SystemLog(string[])
- {
- new waypoint[128];
- format(waypoint, sizeof(waypoint), "%s\r\n",string);
- new File:hFile;
- hFile = fopen("/logs/shs.txt", io_append);
- fwrite(hFile, waypoint);
- fclose(hFile);
- }
- 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement