public OnPlayerUpdate(playerid)
{
if(!IsPlayerConnected(playerid)) return 0;
new gun = GetPlayerWeapon(playerid);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(gun == 28 || gun == 29 || gun == 32)
{
SetPlayerArmedWeapon(playerid,0);
return 0;
}
}
return 1;
}
Originally Posted by FreshKilla [PR-RP
]
Anti Drive By + Blocks weapons if there synced from the SA-MP bug. |
#define isEven(%1) \ (!((%1)&(01)))
#define isPowerOfTwo(%1) \ (!(%1)&(%1-1))
IsVehicleRc(vehicleid) { switch(GetVehicleModel(vehicleid)){ case 441, 464, 465, 501, 564, 594: return true; } return false; }
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { new Float:x, Float:y, Float:z; if(newkeys == KEY_SECONDARY_ATTACK ) { new VehicleSeat = GetPlayerVehicleSeat(playerid); if(VehicleSeat == -1) { for(new forvehicleid; forvehicleid < MAX_VEHICLES; forvehicleid++) { if(!IsVehicleRc(forvehicleid)) continue; GetVehiclePos(forvehicleid, x, y, z); if(IsPlayerInRangeOfPoint(playerid, 6, x, y, z)) { PutPlayerInVehicle(playerid, forvehicleid, 0); break; } } } else if(VehicleSeat == 0) { if(IsVehicleRc(GetPlayerVehicleID(playerid))) { GetPlayerPos(playerid, x, y, z); SetPlayerPos(playerid, x+1, y, z+1.0); } } } if(newkeys == KEY_FIRE || newkeys == 12 || newkeys == 36) { if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 564) { new Float:angle; GetPlayerPos(playerid,x,y,z); GetVehicleZAngle(GetPlayerVehicleID(playerid), angle); x += (30 * floatsin(-angle + 5, degrees)); y += (30 * floatcos(-angle + 5, degrees)); CreateExplosion(x,y,z,3,4.0); } } return 1; }
if(!ispassenger)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(GetPlayerVehicleID(i) == vehicleid && GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new Float:cx, Float:cy, Float:cz;
GetPlayerPos(playerid, cx, cy, cz);
SetPlayerPos(playerid, cx, cy, cz);
SendClientMessage(playerid,COLOR_GREY," Someone is driving this vehicle, You must take it Properly !");
}
}
}
Originally Posted by radi
where do i have tho place that code freshkilla ?
|
if(strcmp(cmd, "/haha", true) == 0) { new player; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "[USAGE]: /haha [playerid]"); } player = ReturnUser(tmp); if (player == playerid) { SendClientMessage(player, COLOR_RED, "You canґt laugh at yourself!"); return 1; } if(IsPlayerConnected(player)) { if(player != INVALID_PLAYER_ID) { new string[128]; GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s laughs at you!", sendername); SendClientMessage(playerid,COLOR_RED,string); } } return 1; }
if(strcmp(cmd, "/haha", true) == 0) { new player = ReturnUser(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) SendClientMessage(playerid, COLOR_WHITE, "[USAGE]: /haha [playerid]"); if (player == playerid) return SendClientMessage(player, COLOR_RED, "You canґt laugh at yourself!"); if(!IsPlayerConnected(player)) return SendClientMessage(playerid,COLOR_RED,"Invalid Playerid"); new string[128]; GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "* %s laughs at you!", sendername); SendClientMessage(playerid,COLOR_RED,string); return 1; }
forward fabs(a); forward Float:ffabs(Float:a); public fabs(a)//int { if(a<0)return -a; else return a; } public Float:ffabs(Float:a)//float(for position,health etc.) { if(a<0)return -a; else return a; }
forward fadd(a,value); forward Float:ffadd(Float:a,Float:value); public fadd(a,value)//int { if(a<0)return a-value; else return a+value; } public Float:ffadd(Float:a,Float:value)//float(for position,health etc.) { if(a<0)return a-b; else return a+b; }
Originally Posted by FreshKilla [PR-RP
]
Anti Drive By + Blocks weapons if there synced from the SA-MP bug. pawn Код:
|
Originally Posted by RoamPT
But it doesn't return the weapons to the player right?
|
Originally Posted by kymsar
absolute to add/minus a value,uses for x,y,z 's value ++
Код:
forward fadd(a,value); forward Float:ffadd(Float:a,Float:value); public fadd(a,value)//int { if(a<0)return a-value; else return a+value; } public Float:ffadd(Float:a,Float:value)//float(for position,health etc.) { if(a<0)return a-b; else return a+b; } |
if(strcmp(cmdtext, "/whereami", true) == 0 && IsPlayerAdmin(playerid)) { new Float:px, Float:py, Float:pz; GetPlayerPos(playerid, px, py, pz); new wherestringx[30]; new wherestringy[30]; new wherestringz[30]; format(wherestringx,sizeof(wherestringx),"** Position: X: %f **", px); format(wherestringy,sizeof(wherestringy),"** Position: Y: %f **", py); format(wherestringz,sizeof(wherestringz),"** Position: Z: %f **", pz); SendClientMessage(playerid, COLOR_WHITE, "Your Coordinate are also display in host console"); SendClientMessage(playerid, COLOR_WHITE, wherestringx); SendClientMessage(playerid, COLOR_WHITE, wherestringy); SendClientMessage(playerid, COLOR_WHITE, wherestringz); print(wherestringx); print(wherestringy); print(wherestringz); return 1; }
Originally Posted by [KMA
Lord_Deji ]
/WhereAmI Gives your location/coordinates X Y Z and facing angle it also display them in the host console Код:
if(strcmp(cmdtext, "/whereami", true) == 0 && IsPlayerAdmin(playerid)) { new Float:px, Float:py, Float:pz; GetPlayerPos(playerid, px, py, pz); new wherestringx[30]; new wherestringy[30]; new wherestringz[30]; format(wherestringx,sizeof(wherestringx),"** Position: X: %f **", px); format(wherestringy,sizeof(wherestringy),"** Position: Y: %f **", py); format(wherestringz,sizeof(wherestringz),"** Position: Z: %f **", pz); SendClientMessage(playerid, COLOR_WHITE, "Your Coordinate are also display in host console"); SendClientMessage(playerid, COLOR_WHITE, wherestringx); SendClientMessage(playerid, COLOR_WHITE, wherestringy); SendClientMessage(playerid, COLOR_WHITE, wherestringz); print(wherestringx); print(wherestringy); print(wherestringz); return 1; } |
if(strcmp(cmdtext, "/whereami", true) == 0 && IsPlayerAdmin(playerid))
{
new Float:px, Float:py, Float:pz, wherestringxyz[100];
GetPlayerPos(playerid, px, py, pz);
format(wherestringxyz,sizeof(wherestringxyz),"** Position X: %f Position Y: %f Position Z: %f **", px, py, pz);
SendClientMessage(playerid, COLOR_WHITE, wherestringxyz);
print(wherestringxyz);
return 1;
}
Originally Posted by [KMA
Lord_Deji ]
/WhereAmI Gives your location/coordinates X Y Z and facing angle it also display them in the host console (oops old code for lines) edited Код:
if(strcmp(cmdtext, "/whereami", true) == 0 && IsPlayerAdmin(playerid)) { new Float:px, Float:py, Float:pz; new Float:A; GetPlayerPos(playerid, px, py, pz); GetPlayerFacingAngle(playerid, A); new wherestringx[30]; new wherestringy[30]; new wherestringz[30]; new wherestringA[30]; format(wherestringx,sizeof(wherestringx),"** Position: X: %f **", px); format(wherestringy,sizeof(wherestringy),"** Position: Y: %f **", py); format(wherestringz,sizeof(wherestringz),"** Position: Z: %f **", pz); format(wherestringA,sizeof(wherestringA),"** FacingAngle: %f **", A); SendClientMessage(playerid, COLOR_WHITE, "Your Coordinate are also display in host console"); SendClientMessage(playerid, COLOR_WHITE, wherestringx); SendClientMessage(playerid, COLOR_WHITE, wherestringy); SendClientMessage(playerid, COLOR_WHITE, wherestringz); SendClientMessage(playerid, COLOR_WHITE, wherestringA); print(wherestringx); print(wherestringy); print(wherestringz); print(wherestringA); return 1; } |
// Hide player blips on entering interiors fix for samp 0.3 new gPlayerOldColor[MAX_PLAYERS]; // temp var if we need to change the color for a sec public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid) { // Entering interiors: hide player blip if(oldinteriorid == 0) { gPlayerOldColor[playerid] = GetPlayerColor(playerid); SetPlayerColor(playerid, ( gPlayerOldColor[playerid] & 0xFFFFFF00 )); } // Leaving interiors: restore player blip else if(newinteriorid == 0) SetPlayerColor(playerid, gPlayerOldColor[playerid]); return true; }